Profile配置

172 阅读1分钟

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

1、新建生产环境配置文件:

application-prod.properties

server.port=80

2、新建开发环境配置文件:

application-dev.properties

server.port=8888

3、修改application.properties

spring.profiles.active=dev或者spring.profiles.active=prod