1.在Spring配置文件applicationContext.xml中定义两组环境

<beans profile="production">
		<!-- 生成环境 -->
	</beans>
	
	<beans profile="test">
		<!-- 测试环境 -->
	</beans>

2.在web.xml中,设定使用哪种环境

<context-param>
    	<param-name>spring.profiles.active</param-name>
    	<param-value>production</param-value>
	</context-param>