With Spring the typical setup would be to have properties files, like the
following jdbc.properties file (from the appfuse example):
jdbc.driverClassName=${jdbc.driverClassName}
jdbc.url=${jdbc.url}
jdbc.username=${jdbc.username}
jdbc.password=${jdbc.password}
Then in your applicationContext.xml refer to those properties with ${} place
holders and Spring's PropertyPlaceholderConfigurer will do the ${}
substitutions:
<bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:jdbc.properties</value>
</list>
</property>
</bean>
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName" value="${jdbc.driverClassName}"/>
<property name="url" value="${jdbc.url}"/>
<property name="username" value="${jdbc.username}"/>
<property name="password" value="${jdbc.password}"/>
</bean>
Before I started using Maven my jdbc.properties files had the final values, no
${} place holders. But now with Maven the final values are in the profiles.xml
file in a properties section in profiles. It seems to me that since the
applicationContext.xml file is in the resources folder that Maven can rewrite
it just as well as it can the jdbc.properties file so I tossed my
jdbc.properties file.
Is there any advantage to keeping the jdbc.properties file with its ${} place
holders? It just seems to me to be an extra and unnecessary layer.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]