释放双眼,带上耳机,听听看~!
自定义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