Configure Spring data source for test & production environment
Hi all,
I have configured DataSource in applicationContext, using propertyPlaceHolder
Code:
<beans>
<!-- the property configurer -->
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<!-- default values for testing -->
<value>classpath:SqlConnStringDbExp.properties</value>
</list>
</property>
</bean>
<bean id="dataSource" destroy-method="close" class="it.genialloyd.startup.GenialBasicDataSource">
<property name="driverClassName"> <value>net.sourceforge.jtds.jdbc.Driver</value></property>
<property name="url"> <value>${jdbc.urljtds}</value></property>
<property name="username"><value>uteappl</value></property>
<property name="password"><value>${jdbc.password}</value></property>
</bean>
I would like to load the production property file in production environment, and the test property in test environment.
I've just found a solution to place the property outside the classpath, so different server have different file, not overwritten by the class file.
Quote:
<value>file:c/pathtopropery/SqlConnStringDbExp.properties</value>
Any hint?
Thanks