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()方法。

  • 相关阅读:
    css 面试学习
    关于CSS的图像放大问题的解决,需要借助jQuery等直接用css3设置
    DEBUG使用
    crontab
    od
    dumpe2fs
    mke2fs
    dd
    GDB
    rm
  • 原文地址:https://www.cnblogs.com/lzmrex/p/15797424.html
Copyright © 2011-2022 走看看