getConnection()
call, that is, implicitly invoking getConnection(ConnectionSpec)
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 a ConnectionSpec configured. Client code can work with the ConnectionFactory without passing in a ConnectionSpec on every getConnection()
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/cci/mycf"/> </bean> <bean id="myConnectionFactory" class="org.springframework.jca.cci.connection.ConnectionSpecConnectionFactoryAdapter"> <property name="targetConnectionFactory" ref="myTargetConnectionFactory"/> <property name="connectionSpec"> <bean class="your.resource.adapter.ConnectionSpecImpl"> <property name="username" value="myusername"/> <property name="password" value="mypassword"/> </bean> </property> </bean>
If the "connectionSpec" is empty, this proxy will simply delegate to the standard getConnection()
method of the target ConnectionFactory. This can be used to keep a UserCredentialsConnectionFactoryAdapter bean definition just for the option of implicitly passing in a ConnectionSpec if the particular target ConnectionFactory requires it.
@author Juergen Hoeller
@since 1.2
@see #getConnection
|
|
|
|