SpringBoot加载指定配置文件的几种配置方式

时间:2020-07-21 13:11:13   收藏:0   阅读:1016

@PropertySource+@Value(普通属性配置)

技术分享图片

PropertySourcesPlaceholderConfigurer+YamlPropertiesFactoryBean(启动配置)

技术分享图片

通过启动参数spring.config.name(启动配置)

技术分享图片

--spring.config.name :配置配置文件前缀(默认的配置文件前缀为application)

通过启动参数spring.config.location(启动配置)

技术分享图片

--spring.config.location :配置配置文件地址,多个文件用英文逗号隔开

原文:https://www.cnblogs.com/lyp-make/p/13353321.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!