语法结构:application-profile.properties/yml

profile:代表某个配置环境的标识

示例:

 

    application-dev.properties/yml  开发环境

 

  application-test.properties/yml  测试环境

 

  application.prod.properties/yml  生产环境

 

  1,properties配置文件

    Springboot的多环境配置

 

 

        Springboot的多环境配置

 

  2,yml配置文件  

    Springboot的多环境配置

 

    或者

       Springboot的多环境配置

 

     Springboot的多环境配置

 

 

 

        

 

 

 

 

Windows环境下启动

  java -jar  项目名字 --spring.profiles.active={profile}

Springboot的多环境配置

 

相关文章:

  • 2021-07-23
  • 2021-06-08
  • 2022-02-24
  • 2022-02-02
猜你喜欢
  • 2022-12-23
  • 2021-04-01
  • 2022-01-15
  • 2021-04-08
  • 2021-05-19
  • 2021-06-02
相关资源
相似解决方案