我是靠谱客的博主 眼睛大期待,这篇文章主要介绍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;
    }

}

 

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

最后

以上就是眼睛大期待最近收集整理的关于springboot配置多个yml文件的全部内容,更多相关springboot配置多个yml文件内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(40)

评论列表共有 0 条评论

立即
投稿
返回
顶部