0
点赞
收藏
分享

微信扫一扫

Spring Boot Profile 配置


Profile是Spring用来针对不同环境对不同配置文件的支持,全局的配置使用application-{profile}.properties(如:application-dev.properties)。

通过在application.properties文件中设置spring.profiles.active=dev来指定活动的Profile。

下面我们来指定开发环境端口是8080,正式环境是80

  1. 生产环境和开发环境的配置如下:

application-prod.properties

server.port=80

application-dev.properties

server.port=8080

  1. 在application.properties文件中设置活动的Profile:

spring.profiles.active=dev

举报

相关推荐

0 条评论