spring.profiles.active

来源:互联网 发布:美橙域名怎么样 编辑:程序博客网 时间:2024/05/17 12:06
1.在Spring配置文件applicationContext.xml中定义两组环境
Java代码  收藏代码
  1. <beans profile="production">  
  2.     <!-- 生成环境 -->  
  3. </beans>  
  4.   
  5. <beans profile="test">  
  6.     <!-- 测试环境 -->  
  7. </beans>  


2.在web.xml中,设定使用哪种环境
Java代码  收藏代码
  1. <context-param>  
  2.     <param-name>spring.profiles.active</param-name>  
  3.     <param-value>production</param-value>  
  4. </context-param> 
0 0
原创粉丝点击