springboot之加载配置文件

1,springboot加载配置文件的代码在。

    1,ConfigFileApplicationListener的loadIntoGroup方法

    2,加载方式有file,classpath。加载目录也多种。详情请 自己dibug

    3,加载文件格式有 xml。yml,与 pro

    ,4,加载 yml文件,必须依赖  snakeyaml 包,没有snakeyaml包,是无法加载 yml配置文件的

PropertySourcesLoader.addPropertySource()

PropertySourcesLoader.propertySources 所有加载的配置都会放入这个属性中。

猜你喜欢

转载自jahu.iteye.com/blog/2332806