I posted on another method for doing this a while back and this alternate approach was sent me some time ago so I thought I would share it here. The issue trying to be addressed is the ability to deliver a single WAR file to multiple environments that each may need different configurations. For example, a QA environment, an automated testing environment, a developer's personal environment, a customer's installation, or a hosted production instance. To do this you need to externalize your applications configuration or build a UI and maintain the configuration in your database. Using property files is a simple approach and works quite well and has some advantages over the database approach if your application instances are ephemeral.
You can have a default properties file and afterwards overwrite it with a file that is external to your application. The "properties overwrite file" is optional
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"></bean> <bean id="propertyOverrideConfigurer" class="org.springframework.beans.factory.config.PropertyOverrideConfigurer"> </bean>
References:
- http://static.springsource.org/spring/docs/2.5.x/reference/xsd-config.html
- http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/beans.html#beans-factory-overrideconfigure
No comments:
Post a Comment