Java 类org.springframework.boot.bind.PropertySourcesBinder 实例源码

项目:druid-spring-boot    文件:DruidDataSourceConfiguration.java   
@Override
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
    if (bean instanceof DruidDataSource) {
        // 设置 Druid 名称
        ((DruidDataSource) bean).setName(beanName);
        // 将 'spring.datasource.druid.data-sources.${name}' 的配置绑定到 Bean
        if (!resolver.getSubProperties(EMPTY).isEmpty()) {
            PropertySourcesBinder binder = new PropertySourcesBinder(environment);
            binder.bindTo(PREFIX + beanName, bean);
        }
        // 用户自定义配置
        if (customizers != null && !customizers.isEmpty()) {
            for (DruidDataSourceCustomizer customizer : customizers) {
                customizer.customize((DruidDataSource) bean);
            }
        }
        boolean isSingle = BEAN_NAME.equals(beanName);
        if (isSingle) {
            log.debug("druid data-source init...");
        } else {
            log.debug("druid {}-data-source init...", beanName);
        }
    }
    return bean;
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:EndpointAutoConfigurationTests.java   
GitFullInfoContributor(Resource location) throws BindException, IOException {
    if (location.exists()) {
        Properties gitInfoProperties = PropertiesLoaderUtils
                .loadProperties(location);
        PropertiesPropertySource gitPropertySource = new PropertiesPropertySource(
                "git", gitInfoProperties);
        this.content = new PropertySourcesBinder(gitPropertySource)
                .extractAll("git");
    }
}
项目:spring-boot-concourse    文件:EndpointAutoConfigurationTests.java   
GitFullInfoContributor(Resource location) throws BindException, IOException {
    if (location.exists()) {
        Properties gitInfoProperties = PropertiesLoaderUtils
                .loadProperties(location);
        PropertiesPropertySource gitPropertySource = new PropertiesPropertySource(
                "git", gitInfoProperties);
        this.content = new PropertySourcesBinder(gitPropertySource)
                .extractAll("git");
    }
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:EnvironmentInfoContributor.java   
public EnvironmentInfoContributor(ConfigurableEnvironment environment) {
    this.binder = new PropertySourcesBinder(environment);
}
项目:spring-boot-concourse    文件:EnvironmentInfoContributor.java   
public EnvironmentInfoContributor(ConfigurableEnvironment environment) {
    this.binder = new PropertySourcesBinder(environment);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:InfoPropertiesInfoContributor.java   
/**
 * Extract the raw content based on the specified {@link PropertySource}.
 * @param propertySource the property source to use
 * @return the raw content
 */
protected Map<String, Object> extractContent(PropertySource<?> propertySource) {
    return new PropertySourcesBinder(propertySource).extractAll("");
}
项目:spring-boot-concourse    文件:InfoPropertiesInfoContributor.java   
/**
 * Extract the raw content based on the specified {@link PropertySource}.
 * @param propertySource the property source to use
 * @return the raw content
 */
protected Map<String, Object> extractContent(PropertySource<?> propertySource) {
    return new PropertySourcesBinder(propertySource).extractAll("");
}