java - Why I can't success when I set spring.profiles.active in web.xml -
i have server data sources, use profile in spring3.1, web.xml:
<context-param> <param-name>contextconfiglocation</param-name> <param-value>classpath:applicationcontext.xml,classpath:applicationcontext-dao.xml,classpath:sqlmapconfig.xml</param-value> </context-param> <context-param> <param-name>spring.profiles.active</param-name> <param-value>test</param-value> </context-param> <listener> <listener-class>org.springframework.web.context.contextloaderlistener</listener-class> </listener>
and applicationcontext.xml:
<beans profile="develop"> <context:property-placeholder location="classpath:develop.properties"/> </beans> <beans profile="test"> <context:property-placeholder location="classpath:test.properties"/> </beans>
but doesn't work, can't value of spring.profiles.active
, in servelet:
log.debug("spring.profiles.active" + system.getproperty("spring.profiles.active"));
this log null
, : servletcontext sc=this.getservletcontext(); log.error(sc.getinitparameter("spring.profiles.active")); log value of spring.profiles.active
configure in web.xml
, can me, lot.
Comments
Post a Comment