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

配置方式:

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

  <beans profile="dev">  

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

  </beans>

  <beans profile="prd"

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

  </beans

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

  <context-param>  

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

    <param-value>dev</param-value

  </context-param

相关文章:

  • 2021-04-01
  • 2021-07-20
  • 2021-08-30
  • 2021-06-30
  • 2021-05-21
  • 2021-12-11
  • 2022-12-23
  • 2021-09-11
猜你喜欢
  • 2021-05-24
  • 2021-06-05
  • 2022-12-23
  • 2021-12-27
  • 2022-12-23
  • 2021-09-07
  • 2022-12-23
相关资源
相似解决方案