ProfileApplicationContextInitializer.java 文件源码

java
阅读 27 收藏 0 点赞 0 评论 0

项目:spring-seed 作者:
@Override
public void initialize(ConfigurableApplicationContext applicationContext) {
    this.environment = applicationContext.getEnvironment();
    this.resourceLoader = applicationContext;
    this.profile = Profiles.getActiveProfile(environment);

    NameLocationPair pair = getPropertySourceFirst();
    if(pair != null){
        addPropertySource(pair.getName(),pair.getLocation());
    }
    addPropertySource(OVERRIDE_PROPERTIES_SOURCE_NAME, System.getProperty(OVERRIDE_PROPERTIES_SOURCE_LOCATION));
    addPropertySource(PROJECT_PROPERTIES_SOURCE_NAME, PROJECT_PROPERTIES_SOURCE_LOCATION);
    addPropertySource(PROJECT_PROPERTIES_SOURCE_DEFAULT_NAME, PROJECT_PROPERTIES_SOURCE_DEFAULT_LOCATION);
    addPropertySource(PARENT_PROPERTIES_SOURCE_NAME, PARENT_PROPERTIES_SOURCE_LOCATION);
    addPropertySource(PARENT_PROPERTIES_SOURCE_DEFAULT_NAME, PARENT_PROPERTIES_SOURCE_DEFAULT_LOCATION);

    LogbackConfig.init(LOGBACK_CONFIG_LOCATION);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号