Okay, so we have an application that uses Spring 2. I have a bean that accesses a method which returns a username (process ID) and password to be used in a database connection. The problem I am having is retrieving those values. Spring 2 seems to want to return the literal values for the property values (ie. #{pid.username} instead of the value of username). Here is what I have...
<bean id="pidReader" class="com.blah.biz.securepid.DefaultPIDReader" /> <bean id="pid" factory-bean="pidReader" factory-method="readPIDCredentials"> <constructor-arg value="arg" /> </bean> <bean id="datasource" class="org.apache.commons.dbcp.BasicDataSource"> <property name="username"> <value>#{pid.username}</value> </property> <property name="password"> <value>#{pid.password}</value> </property> <property name="driverClassName"> <value>driver</value> </property> <property name="url"> <value>url</value> </property> </bean>
The DefaultPIDReader class is located in a library that is referenced by the main app. This works fine for the apps that are running Spring 3. Is there any way in Spring 2 to return the value of pid.username. Someone mentioned using the util namespace, but I cannot find anything that works. And upgrading to Spring 3 (on this app anyway) is not an option.