spring.profiles.active 针对多种启动环境的spring配置

使用spring.profiles.active 配置正式环境,测试环境web

配置方式:spring

一、在spring配置文件中配置两种环境信息tomcat

  <beans profile="dev">  测试

     <context:property-placeholder location="classpath:jdbc-dev.properties"/> spa

  </beans>xml

  <beans profile="prd"io

    <context:property-placeholder location="classpath:jdbc-prd.properties"/> class

  </beans
配置

二、在web.xml中配置使用哪一种环境信息,tomcat启动的时候自动去加载对应的环境信息file

  <context-param>  

    <param-name>spring.profiles.active</param-name

    <param-value>dev</param-value

  </context-param

相关文章
相关标签/搜索