SpringBoot使用yml配置多 profile

profile是Spring对不同环境提供不同配置功能的支持,可以通过激活、指定参数的方式来快速切换环境。
第一种方式
yml多文档块方式
在这里插入图片描述
第二种方式
在这里插入图片描述
第三中方式
先将项目打包,然后运行命令。

java -jar spring-boot-hello-quick-0.0.1-SNAPSHOT.jar --spring.profiles.active=prod

在这里插入图片描述
第四种方式
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/guinailu/article/details/86613347