Top Description Inners Fields Constructors Methods
org.springframework.jms.connection

public Class UserCredentialsConnectionFactoryAdapter

extends Object
implements ConnectionFactory, QueueConnectionFactory, TopicConnectionFactory, InitializingBean
Class Inheritance
All Implemented Interfaces
org.springframework.beans.factory.InitializingBean, jakarta.jms.TopicConnectionFactory, jakarta.jms.ConnectionFactory, jakarta.jms.QueueConnectionFactory
Imports
jakarta.jms.Connection, .ConnectionFactory, .JMSContext, .JMSException, .QueueConnection, .QueueConnectionFactory, .TopicConnection, .TopicConnectionFactory, org.springframework.beans.factory.InitializingBean, org.springframework.core.NamedThreadLocal, org.springframework.lang.Nullable, org.springframework.util.Assert, .StringUtils

An adapter for a target JMS jakarta.jms.ConnectionFactory, applying the given user credentials to every standard createConnection() call, that is, implicitly invoking createConnection(username, password) on the target. All other methods simply delegate to the corresponding methods of the target ConnectionFactory.

Can be used to proxy a target JNDI ConnectionFactory that does not have user credentials configured. Client code can work with the ConnectionFactory without passing in username and password on every createConnection() call.

In the following example, client code can simply transparently work with the preconfigured "myConnectionFactory", implicitly accessing "myTargetConnectionFactory" with the specified user credentials.

<bean id="myTargetConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
  <property name="jndiName" value="java:comp/env/jms/mycf"/>
</bean>

<bean id="myConnectionFactory" class="org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter">
  <property name="targetConnectionFactory" ref="myTargetConnectionFactory"/>
  <property name="username" value="myusername"/>
  <property name="password" value="mypassword"/>
</bean>

If the "username" is empty, this proxy will simply delegate to the standard createConnection() method of the target ConnectionFactory. This can be used to keep a UserCredentialsConnectionFactoryAdapter bean definition just for the option of implicitly passing in user credentials if the particular target ConnectionFactory requires it.

As of Spring Framework 5, this class delegates JMS 2.0 JMSContext calls and therefore requires the JMS 2.0 API to be present at runtime. It may nevertheless run against a JMS 1.1 driver (bound to the JMS 2.0 API) as long as no actual JMS 2.0 calls are triggered by the application's setup.

Author
Juergen Hoeller
Since
1.2
See Also
createConnection, createQueueConnection, createTopicConnection

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
UserCredentialsConnectionFactoryAdapter.JmsUserCredentials

Inner class used as ThreadLocal value.

Field Summary

Modifier and TypeField and Description
private String
private ConnectionFactory
private final ThreadLocal<UserCredentialsConnectionFactoryAdapter.JmsUserCredentials>
private String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
afterPropertiesSet()

Implements org.springframework.beans.factory.InitializingBean.afterPropertiesSet.

Invoked by the containing BeanFactory after it has set all bean properties and satisfied BeanFactoryAware, ApplicationContextAware etc.

This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set.

public final Connection
createConnection()

Implements jakarta.jms.ConnectionFactory.createConnection.

Determine whether there are currently thread-bound credentials, using them if available, falling back to the statically specified username and password (i.e. values of the bean properties) otherwise.

public Connection
createConnection(String
the caller's user name
username
,
String
the caller's password
password
)

Implements jakarta.jms.ConnectionFactory.createConnection.

Delegate the call straight to the target ConnectionFactory.

public JMSContext
createContext()

Implements jakarta.jms.ConnectionFactory.createContext.

Creates a JMSContext with the default user identity and an unspecified sessionMode.

public JMSContext
createContext(String
the caller's user name
userName
,
String
the caller's password
password
)

Implements jakarta.jms.ConnectionFactory.createContext.

Creates a JMSContext with the specified user identity and an unspecified sessionMode.

public JMSContext
createContext(String
the caller's user name
userName
,
String
the caller's password
password
,
int
indicates which of four possible session modes will be used.
  • If this method is called in a Java SE environment or in the Jakarta EE application client container, the permitted values are JMSContext.SESSION_TRANSACTED, JMSContext.CLIENT_ACKNOWLEDGE, JMSContext.AUTO_ACKNOWLEDGE and JMSContext.DUPS_OK_ACKNOWLEDGE.
  • If this method is called in the Jakarta EE web or EJB container when there is an active JTA transaction in progress then this argument is ignored.
  • If this method is called in the Jakarta EE web or EJB container when there is no active JTA transaction in progress, the permitted values are JMSContext.AUTO_ACKNOWLEDGE and JMSContext.DUPS_OK_ACKNOWLEDGE. In this case the values JMSContext.TRANSACTED and JMSContext.CLIENT_ACKNOWLEDGE are not permitted.
sessionMode
)

Implements jakarta.jms.ConnectionFactory.createContext.

Creates a JMSContext with the specified user identity and the specified session mode.

public JMSContext
createContext(int
indicates which of four possible session modes will be used.
  • If this method is called in a Java SE environment or in the Jakarta EE application client container, the permitted values are JMSContext.SESSION_TRANSACTED, JMSContext.CLIENT_ACKNOWLEDGE, JMSContext.AUTO_ACKNOWLEDGE and JMSContext.DUPS_OK_ACKNOWLEDGE.
  • If this method is called in the Jakarta EE web or EJB container when there is an active JTA transaction in progress then this argument is ignored.
  • If this method is called in the Jakarta EE web or EJB container when there is no active JTA transaction in progress, the permitted values are JMSContext.AUTO_ACKNOWLEDGE and JMSContext.DUPS_OK_ACKNOWLEDGE. In this case the values JMSContext.TRANSACTED and JMSContext.CLIENT_ACKNOWLEDGE are not permitted.
sessionMode
)

Implements jakarta.jms.ConnectionFactory.createContext.

Creates a JMSContext with the default user identity and the specified session mode.

public final QueueConnection
createQueueConnection()

Implements jakarta.jms.QueueConnectionFactory.createQueueConnection.

Determine whether there are currently thread-bound credentials, using them if available, falling back to the statically specified username and password (i.e. values of the bean properties) else.

public QueueConnection
createQueueConnection(String
the caller's user name
username
,
String
the caller's password
password
)

Implements jakarta.jms.QueueConnectionFactory.createQueueConnection.

Delegate the call straight to the target QueueConnectionFactory.

public final TopicConnection
createTopicConnection()

Implements jakarta.jms.TopicConnectionFactory.createTopicConnection.

Determine whether there are currently thread-bound credentials, using them if available, falling back to the statically specified username and password (i.e. values of the bean properties) else.

public TopicConnection
createTopicConnection(String
the caller's user name
username
,
String
the caller's password
password
)

Implements jakarta.jms.TopicConnectionFactory.createTopicConnection.

Delegate the call straight to the target TopicConnectionFactory.

protected Connection

Returns:

the Connection
doCreateConnection
(String
the username to use
username
,
String
the password to use
password
)

This implementation delegates to the createConnection(username, password) method of the target ConnectionFactory, passing in the specified user credentials.

protected QueueConnection

Returns:

the Connection
doCreateQueueConnection
(String
the username to use
username
,
String
the password to use
password
)

This implementation delegates to the createQueueConnection(username, password) method of the target QueueConnectionFactory, passing in the specified user credentials.

protected TopicConnection

Returns:

the Connection
doCreateTopicConnection
(String
the username to use
username
,
String
the password to use
password
)

This implementation delegates to the createTopicConnection(username, password) method of the target TopicConnectionFactory, passing in the specified user credentials.

private ConnectionFactory
public void
removeCredentialsFromCurrentThread()

Remove any user credentials for this proxy from the current thread.

public void
setCredentialsForCurrentThread(String
the username to apply
username
,
String
the password to apply
password
)

Set user credentials for this proxy and the current thread.

public void
setPassword(String password)

Set the password that this adapter should use for retrieving Connections.

public void
setTargetConnectionFactory(ConnectionFactory targetConnectionFactory)

Set the target ConnectionFactory that this ConnectionFactory should delegate to.

public void
setUsername(String username)

Set the username that this adapter should use for retrieving Connections.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

passwordback to summary
private String password
Annotations
@Nullable
targetConnectionFactoryback to summary
private ConnectionFactory targetConnectionFactory
Annotations
@Nullable
threadBoundCredentialsback to summary
private final ThreadLocal<UserCredentialsConnectionFactoryAdapter.JmsUserCredentials> threadBoundCredentials
usernameback to summary
private String username
Annotations
@Nullable

Constructor Detail

UserCredentialsConnectionFactoryAdapterback to summary
public UserCredentialsConnectionFactoryAdapter()

Method Detail

afterPropertiesSetback to summary
public void afterPropertiesSet()

Implements org.springframework.beans.factory.InitializingBean.afterPropertiesSet.

Doc from org.springframework.beans.factory.InitializingBean.afterPropertiesSet.

Invoked by the containing BeanFactory after it has set all bean properties and satisfied BeanFactoryAware, ApplicationContextAware etc.

This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set.

Annotations
@Override
createConnectionback to summary
public final Connection createConnection() throws JMSException

Implements jakarta.jms.ConnectionFactory.createConnection.

Determine whether there are currently thread-bound credentials, using them if available, falling back to the statically specified username and password (i.e. values of the bean properties) otherwise.

Returns:Connection

Doc from jakarta.jms.ConnectionFactory.createConnection.

a newly created connection

Annotations
@Override
Exceptions
JMSException:

Doc from jakarta.jms.ConnectionFactory.createConnection.

if the Jakarta Messaging provider fails to create the connection due to some internal error.

See Also
doCreateConnection
createConnectionback to summary
public Connection createConnection(String username, String password) throws JMSException

Implements jakarta.jms.ConnectionFactory.createConnection.

Delegate the call straight to the target ConnectionFactory.

Parameters
username:String

Doc from jakarta.jms.ConnectionFactory.createConnection.

the caller's user name

password:String

Doc from jakarta.jms.ConnectionFactory.createConnection.

the caller's password

Returns:Connection

Doc from jakarta.jms.ConnectionFactory.createConnection.

a newly created connection

Annotations
@Override
Exceptions
JMSException:

Doc from jakarta.jms.ConnectionFactory.createConnection.

if the Jakarta Messaging provider fails to create the connection due to some internal error.

createContextback to summary
public JMSContext createContext()

Implements jakarta.jms.ConnectionFactory.createContext.

Doc from jakarta.jms.ConnectionFactory.createContext.

Creates a JMSContext with the default user identity and an unspecified sessionMode.

A connection and session are created for use by the new JMSContext. The connection is created in stopped mode but will be automatically started when a JMSConsumer is created.

The behaviour of the session that is created depends on whether this method is called in a Java SE environment, in the Jakarta EE application client container, or in the Jakarta EE web or EJB container. If this method is called in the Jakarta EE web or EJB container then the behaviour of the session also depends on whether or not there is an active JTA transaction in progress.

In a Java SE environment or in the Jakarta EE application client container:

  • The session will be non-transacted and received messages will be acknowledged automatically using an acknowledgement mode of JMSContext.AUTO_ACKNOWLEDGE For a definition of the meaning of this acknowledgement mode see the link below.

In a Jakarta EE web or EJB container, when there is an active JTA transaction in progress:

  • The session will participate in the JTA transaction and will be committed or rolled back when that transaction is committed or rolled back, not by calling the JMSContext's commit or rollback methods.

In the Jakarta EE web or EJB container, when there is no active JTA transaction in progress:

  • The session will be non-transacted and received messages will be acknowledged automatically using an acknowledgement mode of JMSContext.AUTO_ACKNOWLEDGE For a definition of the meaning of this acknowledgement mode see the link below.
Returns:JMSContext

a newly created JMSContext

Annotations
@Override
createContextback to summary
public JMSContext createContext(String userName, String password)

Implements jakarta.jms.ConnectionFactory.createContext.

Doc from jakarta.jms.ConnectionFactory.createContext.

Creates a JMSContext with the specified user identity and an unspecified sessionMode.

A connection and session are created for use by the new JMSContext. The connection is created in stopped mode but will be automatically started when a JMSConsumer.

The behaviour of the session that is created depends on whether this method is called in a Java SE environment, in the Jakarta EE application client container, or in the Jakarta EE web or EJB container. If this method is called in the Jakarta EE web or EJB container then the behaviour of the session also depends on whether or not there is an active JTA transaction in progress.

In a Java SE environment or in the Jakarta EE application client container:

  • The session will be non-transacted and received messages will be acknowledged automatically using an acknowledgement mode of JMSContext.AUTO_ACKNOWLEDGE For a definition of the meaning of this acknowledgement mode see the link below.

In a Jakarta EE web or EJB container, when there is an active JTA transaction in progress:

  • The session will participate in the JTA transaction and will be committed or rolled back when that transaction is committed or rolled back, not by calling the JMSContext's commit or rollback methods.

In the Jakarta EE web or EJB container, when there is no active JTA transaction in progress:

  • The session will be non-transacted and received messages will be acknowledged automatically using an acknowledgement mode of JMSContext.AUTO_ACKNOWLEDGE For a definition of the meaning of this acknowledgement mode see the link below.
Parameters
userName:String

the caller's user name

password:String

the caller's password

Returns:JMSContext

a newly created JMSContext

Annotations
@Override
createContextback to summary
public JMSContext createContext(String userName, String password, int sessionMode)

Implements jakarta.jms.ConnectionFactory.createContext.

Doc from jakarta.jms.ConnectionFactory.createContext.

Creates a JMSContext with the specified user identity and the specified session mode.

A connection and session are created for use by the new JMSContext. The JMSContext is created in stopped mode but will be automatically started when a JMSConsumer is created.

The effect of setting the sessionMode argument depends on whether this method is called in a Java SE environment, in the Jakarta EE application client container, or in the Jakarta EE web or EJB container. If this method is called in the Jakarta EE web or EJB container then the effect of setting the sessionMode argument also depends on whether or not there is an active JTA transaction in progress.

In a Java SE environment or in the Jakarta EE application client container:

  • If sessionMode is set to JMSContext.SESSION_TRANSACTED then the session will use a local transaction which may subsequently be committed or rolled back by calling the JMSContext's commit or rollback methods.
  • If sessionMode is set to any of JMSContext.CLIENT_ACKNOWLEDGE, JMSContext.AUTO_ACKNOWLEDGE or JMSContext.DUPS_OK_ACKNOWLEDGE. then the session will be non-transacted and messages received by this session will be acknowledged according to the value of sessionMode. For a definition of the meaning of these acknowledgement modes see the links below.

In a Jakarta EE web or EJB container, when there is an active JTA transaction in progress:

  • The argument sessionMode is ignored. The session will participate in the JTA transaction and will be committed or rolled back when that transaction is committed or rolled back, not by calling the JMSContext's commit or rollback methods. Since the argument is ignored, developers are recommended to use createContext(String userName, String password) instead of this method.

In the Jakarta EE web or EJB container, when there is no active JTA transaction in progress:

  • The argument acknowledgeMode must be set to either of JMSContext.AUTO_ACKNOWLEDGE or JMSContext.DUPS_OK_ACKNOWLEDGE. The session will be non-transacted and messages received by this session will be acknowledged automatically according to the value of acknowledgeMode. For a definition of the meaning of these acknowledgement modes see the links below. The values JMSContext.SESSION_TRANSACTED and JMSContext.CLIENT_ACKNOWLEDGE may not be used.
Parameters
userName:String

the caller's user name

password:String

the caller's password

sessionMode:int

indicates which of four possible session modes will be used.

  • If this method is called in a Java SE environment or in the Jakarta EE application client container, the permitted values are JMSContext.SESSION_TRANSACTED, JMSContext.CLIENT_ACKNOWLEDGE, JMSContext.AUTO_ACKNOWLEDGE and JMSContext.DUPS_OK_ACKNOWLEDGE.
  • If this method is called in the Jakarta EE web or EJB container when there is an active JTA transaction in progress then this argument is ignored.
  • If this method is called in the Jakarta EE web or EJB container when there is no active JTA transaction in progress, the permitted values are JMSContext.AUTO_ACKNOWLEDGE and JMSContext.DUPS_OK_ACKNOWLEDGE. In this case the values JMSContext.TRANSACTED and JMSContext.CLIENT_ACKNOWLEDGE are not permitted.
Returns:JMSContext

a newly created JMSContext

Annotations
@Override
createContextback to summary
public JMSContext createContext(int sessionMode)

Implements jakarta.jms.ConnectionFactory.createContext.

Doc from jakarta.jms.ConnectionFactory.createContext.

Creates a JMSContext with the default user identity and the specified session mode.

A connection and session are created for use by the new JMSContext. The JMSContext is created in stopped mode but will be automatically started when a JMSConsumer is created.

The effect of setting the sessionMode argument depends on whether this method is called in a Java SE environment, in the Jakarta EE application client container, or in the Jakarta EE web or EJB container. If this method is called in the Jakarta EE web or EJB container then the effect of setting the sessionMode argument also depends on whether or not there is an active JTA transaction in progress.

In a Java SE environment or in the Jakarta EE application client container:

  • If sessionMode is set to JMSContext.SESSION_TRANSACTED then the session will use a local transaction which may subsequently be committed or rolled back by calling the JMSContext's commit or rollback methods.
  • If sessionMode is set to any of JMSContext.CLIENT_ACKNOWLEDGE, JMSContext.AUTO_ACKNOWLEDGE or JMSContext.DUPS_OK_ACKNOWLEDGE. then the session will be non-transacted and messages received by this session will be acknowledged according to the value of sessionMode. For a definition of the meaning of these acknowledgement modes see the links below.

In a Jakarta EE web or EJB container, when there is an active JTA transaction in progress:

  • The argument sessionMode is ignored. The session will participate in the JTA transaction and will be committed or rolled back when that transaction is committed or rolled back, not by calling the JMSContext's commit or rollback methods. Since the argument is ignored, developers are recommended to use createContext() instead of this method.

In the Jakarta EE web or EJB container, when there is no active JTA transaction in progress:

  • The argument acknowledgeMode must be set to either of JMSContext.AUTO_ACKNOWLEDGE or JMSContext.DUPS_OK_ACKNOWLEDGE. The session will be non-transacted and messages received by this session will be acknowledged automatically according to the value of acknowledgeMode. For a definition of the meaning of these acknowledgement modes see the links below. The values JMSContext.SESSION_TRANSACTED and JMSContext.CLIENT_ACKNOWLEDGE may not be used.
Parameters
sessionMode:int

indicates which of four possible session modes will be used.

  • If this method is called in a Java SE environment or in the Jakarta EE application client container, the permitted values are JMSContext.SESSION_TRANSACTED, JMSContext.CLIENT_ACKNOWLEDGE, JMSContext.AUTO_ACKNOWLEDGE and JMSContext.DUPS_OK_ACKNOWLEDGE.
  • If this method is called in the Jakarta EE web or EJB container when there is an active JTA transaction in progress then this argument is ignored.
  • If this method is called in the Jakarta EE web or EJB container when there is no active JTA transaction in progress, the permitted values are JMSContext.AUTO_ACKNOWLEDGE and JMSContext.DUPS_OK_ACKNOWLEDGE. In this case the values JMSContext.TRANSACTED and JMSContext.CLIENT_ACKNOWLEDGE are not permitted.
Returns:JMSContext

a newly created JMSContext

Annotations
@Override
createQueueConnectionback to summary
public final QueueConnection createQueueConnection() throws JMSException

Implements jakarta.jms.QueueConnectionFactory.createQueueConnection.

Determine whether there are currently thread-bound credentials, using them if available, falling back to the statically specified username and password (i.e. values of the bean properties) else.

Returns:QueueConnection

Doc from jakarta.jms.QueueConnectionFactory.createQueueConnection.

a newly created queue connection

Annotations
@Override
Exceptions
JMSException:

Doc from jakarta.jms.QueueConnectionFactory.createQueueConnection.

if the Jakarta Messaging provider fails to create the queue connection due to some internal error.

See Also
doCreateQueueConnection
createQueueConnectionback to summary
public QueueConnection createQueueConnection(String username, String password) throws JMSException

Implements jakarta.jms.QueueConnectionFactory.createQueueConnection.

Delegate the call straight to the target QueueConnectionFactory.

Parameters
username:String

Doc from jakarta.jms.QueueConnectionFactory.createQueueConnection.

the caller's user name

password:String

Doc from jakarta.jms.QueueConnectionFactory.createQueueConnection.

the caller's password

Returns:QueueConnection

Doc from jakarta.jms.QueueConnectionFactory.createQueueConnection.

a newly created queue connection

Annotations
@Override
Exceptions
JMSException:

Doc from jakarta.jms.QueueConnectionFactory.createQueueConnection.

if the Jakarta Messaging provider fails to create the queue connection due to some internal error.

createTopicConnectionback to summary
public final TopicConnection createTopicConnection() throws JMSException

Implements jakarta.jms.TopicConnectionFactory.createTopicConnection.

Determine whether there are currently thread-bound credentials, using them if available, falling back to the statically specified username and password (i.e. values of the bean properties) else.

Returns:TopicConnection

Doc from jakarta.jms.TopicConnectionFactory.createTopicConnection.

a newly created topic connection

Annotations
@Override
Exceptions
JMSException:

Doc from jakarta.jms.TopicConnectionFactory.createTopicConnection.

if the Jakarta Messaging provider fails to create a topic connection due to some internal error.

See Also
doCreateTopicConnection
createTopicConnectionback to summary
public TopicConnection createTopicConnection(String username, String password) throws JMSException

Implements jakarta.jms.TopicConnectionFactory.createTopicConnection.

Delegate the call straight to the target TopicConnectionFactory.

Parameters
username:String

Doc from jakarta.jms.TopicConnectionFactory.createTopicConnection.

the caller's user name

password:String

Doc from jakarta.jms.TopicConnectionFactory.createTopicConnection.

the caller's password

Returns:TopicConnection

Doc from jakarta.jms.TopicConnectionFactory.createTopicConnection.

a newly created topic connection

Annotations
@Override
Exceptions
JMSException:

Doc from jakarta.jms.TopicConnectionFactory.createTopicConnection.

if the Jakarta Messaging provider fails to create a topic connection due to some internal error.

doCreateConnectionback to summary
protected Connection doCreateConnection(String username, String password) throws JMSException

This implementation delegates to the createConnection(username, password) method of the target ConnectionFactory, passing in the specified user credentials. If the specified username is empty, it will simply delegate to the standard createConnection() method of the target ConnectionFactory.

Parameters
username:String

the username to use

password:String

the password to use

Returns:Connection

the Connection

See Also
jakarta.jms.ConnectionFactory#createConnection(String, String), jakarta.jms.ConnectionFactory#createConnection()
doCreateQueueConnectionback to summary
protected QueueConnection doCreateQueueConnection(String username, String password) throws JMSException

This implementation delegates to the createQueueConnection(username, password) method of the target QueueConnectionFactory, passing in the specified user credentials. If the specified username is empty, it will simply delegate to the standard createQueueConnection() method of the target ConnectionFactory.

Parameters
username:String

the username to use

password:String

the password to use

Returns:QueueConnection

the Connection

See Also
jakarta.jms.QueueConnectionFactory#createQueueConnection(String, String), jakarta.jms.QueueConnectionFactory#createQueueConnection()
doCreateTopicConnectionback to summary
protected TopicConnection doCreateTopicConnection(String username, String password) throws JMSException

This implementation delegates to the createTopicConnection(username, password) method of the target TopicConnectionFactory, passing in the specified user credentials. If the specified username is empty, it will simply delegate to the standard createTopicConnection() method of the target ConnectionFactory.

Parameters
username:String

the username to use

password:String

the password to use

Returns:TopicConnection

the Connection

See Also
jakarta.jms.TopicConnectionFactory#createTopicConnection(String, String), jakarta.jms.TopicConnectionFactory#createTopicConnection()
obtainTargetConnectionFactoryback to summary
private ConnectionFactory obtainTargetConnectionFactory()
removeCredentialsFromCurrentThreadback to summary
public void removeCredentialsFromCurrentThread()

Remove any user credentials for this proxy from the current thread. Statically specified user credentials apply again afterwards.

See Also
setCredentialsForCurrentThread
setCredentialsForCurrentThreadback to summary
public void setCredentialsForCurrentThread(String username, String password)

Set user credentials for this proxy and the current thread. The given username and password will be applied to all subsequent createConnection() calls on this ConnectionFactory proxy.

This will override any statically specified user credentials, that is, values of the "username" and "password" bean properties.

Parameters
username:String

the username to apply

password:String

the password to apply

See Also
removeCredentialsFromCurrentThread
setPasswordback to summary
public void setPassword(String password)

Set the password that this adapter should use for retrieving Connections. Default is no specific password.

setTargetConnectionFactoryback to summary
public void setTargetConnectionFactory(ConnectionFactory targetConnectionFactory)

Set the target ConnectionFactory that this ConnectionFactory should delegate to.

setUsernameback to summary
public void setUsername(String username)

Set the username that this adapter should use for retrieving Connections. Default is no specific user.

org.springframework.jms.connection back to summary

private final Class UserCredentialsConnectionFactoryAdapter.JmsUserCredentials

extends Object
Class Inheritance
  • java.lang.Object
  • org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter.JmsUserCredentials

Inner class used as ThreadLocal value.

Field Summary

Modifier and TypeField and Description
public final String
public final String

Constructor Summary

AccessConstructor and Description
public
JmsUserCredentials(String username, String password)

Method Summary

Modifier and TypeMethod and Description
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

passwordback to summary
public final String password
usernameback to summary
public final String username

Constructor Detail

JmsUserCredentialsback to summary
public JmsUserCredentials(String username, String password)

Method Detail

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override