springboot配置多个yml文件
自定义properties bean,如下:
@Configuration public class ConfigProperties { @Bean public static PropertySourcesPlaceholderConfigurer properties() { PropertySourcesPlaceholderConfigurer configurer = new PropertySourcesPlaceholderConfigurer(); YamlPropertiesFactoryBean yaml = new YamlPropertiesFactoryBean(); yaml.setResources(new ClassPathResource("config/busiConfig.yml"),new ClassPathResource("config/Rocketmq.yml")); configurer.setProperties(yaml.getObject()); return configurer; } }