springboot的profile配置

  Profile是Spring用来针对不同的环境对不同的配置提供支持的,全局Profile配置使用application-{profile}.properties

  通过在application,properties中设置spring.profies.active=***来指定活动的profile

  简单演示,生产环境的端口为80,开发环境的端口为8888.

  配置文件如下:

  appilcation-prod.properties:

      appilcation-dev.properties:

  目录结构:

 appilcation.properties增加:

运行结果:

原文地址:https://www.cnblogs.com/cuibin/p/7413485.html