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

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

PropertySourcesPlaceholderConfigurer+YamlPropertiesFactoryBean(启动配置)

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

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

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

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

posted @ 2020-07-21 09:51  lyp-make  阅读(5201)  评论(0编辑  收藏  举报