zoukankan      html  css  js  c++  java
  • spring 配置文件加载原理

    1. 实现 PropertySourceLocator 接口,比如:NacosPropertySourceLocator

    2. 把实现注册到spring 容器

    @Bean
        public NacosPropertySourceLocator nacosPropertySourceLocator(NacosConfigManager nacosConfigManager) {
            return new NacosPropertySourceLocator(nacosConfigManager);
        }

    3.  PropertySourceBootstrapConfiguration会调用所有的PropertySourceLocator,做properties加载。

    @Configuration(proxyBeanMethods = false)
    @EnableConfigurationProperties(PropertySourceBootstrapProperties.class)
    public class PropertySourceBootstrapConfiguration implements
            ApplicationContextInitializer<ConfigurableApplicationContext>, Ordered {

    注:ApplicationContextInitializer的用途,在spring 容器刷新之前,会调用ApplicationContextInitializer.intialize()方法。

  • 相关阅读:
    Js Array 删除
    语音播报功能
    js实现HashTable
    Js 克隆
    获取电脑名和IP地址
    获取电脑名和Ip
    IIS 配置问题
    WCF 服务
    【并查集】wikioi1001舒适的路线
    【实用】读取信息
  • 原文地址:https://www.cnblogs.com/lzmrex/p/15797424.html
Copyright © 2011-2022 走看看