Spring Boot Profile配置开发和上线产品两种环境

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/chenbetter1996/article/details/85071430

Profile 配置

Profile 是Spring 用来针对不同的环境对不同的配置提供支持的。
全局Profile在resources目录下,使用命名格式 application-{env}.properties。
在跟作用文件application.properties中设置 spring-profiles.active=env 即可指定活动的Profile文件

实例

在这里插入图片描述

如配置运行端口

可以在 application-dev.properties 里面配置开发环境

server.port = 8080

application-prod.properties 里面配置生产环境

# need permission
server.port = 80

猜你喜欢

转载自blog.csdn.net/chenbetter1996/article/details/85071430
今日推荐