java - How to implement environment-specific init parameters in my tomcat application -
i'd able implement configuration-less deployment java application (tomcat7, spring-mvc). example, right considering creating 1 context.xml file each environment (prod, stage, dev) deploy to:
context_prod.xml context_stage.xml context_dev.xml context.xml (for localhost)
on each of our servers have symlink context.xml
point appropriate context file (e.g. context_prod.xml). when deploy, don't have worry changing database references, keys, etc.
i feel there's better way this; perhaps 1 built spring?
spring has added functionality handle environment configuration:
http://blog.springsource.com/2011/02/11/spring-framework-3-1-m1-released/
this still seems little bit complicated me , have done asking in own spring mvc applications our logging. in dispatcherservlet configuation have line:
<context:property-placeholder location="classpath*:/system.properties"/> <util:properties id="mysystemproperties" location="classpath:/logging/log4j-${system.runmode}.properties" />
system.runmode env variable created , set in catalina.sh @ startup this: setting environment variable tessdata_prefix in tomcat
i use spring el reference values want , works per environment. can see did our logging , have different logging configuration file per environment.
Comments
Post a Comment