springboot配置多个yml文件

释放双眼,带上耳机,听听看~!

自定义properties bean,如下:


1
2
3
4
5
6
7
8
9
10
11
12
13
14
1@Configuration
2public class ConfigProperties {
3
4    @Bean
5    public static PropertySourcesPlaceholderConfigurer properties() {
6        PropertySourcesPlaceholderConfigurer configurer = new PropertySourcesPlaceholderConfigurer();
7        YamlPropertiesFactoryBean yaml = new YamlPropertiesFactoryBean();
8        yaml.setResources(new ClassPathResource("config/busiConfig.yml"),new ClassPathResource("config/Rocketmq.yml"));
9        configurer.setProperties(yaml.getObject());
10        return configurer;
11    }
12
13}
14

 

转载于:https://www.cnblogs.com/ligh-test/p/10752072.html

给TA打赏
共{{data.count}}人
人已打赏
安全技术

C++ lambda表达式

2022-1-11 12:36:11

安全技术

JavaScript面向对象编程(9)快速构建继承关系之整合原型链

2021-12-21 16:36:11

个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索