SpringBoot多配置文件-profile

SpringBoot多配置文件-profile,第1张

SpringBoot多配置文件-profile

profile是在不同环境下,配置文件的动态切换的。

多配置文件的构成如下:

其中application.yml是主配置文件,会在这个文件中指定要使用那个配置文件版本

profile激活方式又3种:

配置文件:在application.yml中定义如下字段

spring:
    profiles:
        active: dev

虚拟机参数:-Dspring.profiles.active=dev

命令行参数:java -jar xxx.jar --spring.profiles.active=dev

 

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zaji/5137778.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-11-18
下一篇2022-11-17

发表评论

登录后才能评论

评论列表(0条)

    保存