Women in Technology

Hear us Roar



Article:
  Advanced Configuration of the Spring MVC Framework
Subject:   Alternative
Date:   2006-06-01 11:43:04
From:   MMS_WL
why not add the host to the properties file?


server.jdbc.user=live_user
server.jdbc.url=jdbc:postgresql://db.host.com:5432/db
server.magic.file.location=/var/magic_file
devel.jdbc.user=devel_user
devel.jdbc.url=jdbc:postgresql://devel-db.host.com:5432/db
devel.magic.file.location=c:\\var\magic_file


my.property=some other prop



<bean id="propertyConfigurer"
class="com.util.spring.HostPrecedingPropertyPlaceholderConfigurer">
<property name="location" value="classpath:config.properties" />
</bean>
<bean id="dataSource"
class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close">
<property name="driverClass" value="${jdbc.driverClass}" />
<property name="jdbcUrl" value="${jdbc.url}" />
<property name="user" value="${jdbc.user}" />
<property name="password" value="${jdbc.password}" />
</bean>


Then append in a new "HostPrecedingPropertyPlaceholderConfigurer" class


http://jdwyah.blogspot.com/2006/06/alternatives-to-advanced-configuration.html