Java 类org.springframework.boot.context.properties.ConfigurationBeanFactoryMetaData 实例源码

项目:ARCLib    文件:Gatherer.java   
private Map<String, Object> extract(ApplicationContext context, ObjectMapper mapper) {
    Map<String, Object> result = new LinkedHashMap<>();
    ConfigurationBeanFactoryMetaData beanFactoryMetaData = getBeanFactoryMetaData(
            context);
    Map<String, Object> beans = getConfigurationPropertiesBeans(context,
            beanFactoryMetaData);
    for (Map.Entry<String, Object> entry : beans.entrySet()) {
        String beanName = entry.getKey();
        Object bean = entry.getValue();
        Map<String, Object> root = new LinkedHashMap<String, Object>();
        String prefix = extractPrefix(context, beanFactoryMetaData, beanName, bean);
        root.put("prefix", prefix);
        root.put("properties", sanitize(prefix, safeSerialize(mapper, bean, prefix)));
        result.put(beanName, root);
    }
    if (context.getParent() != null) {
        result.put("parent", extract(context.getParent(), mapper));
    }
    return result;
}
项目:ARCLib    文件:Gatherer.java   
/**
 * Extract configuration prefix from {@link ConfigurationProperties} annotation.
 * @param context the application context
 * @param beanFactoryMetaData the bean factory meta-data
 * @param beanName the bean name
 * @param bean the bean
 * @return the prefix
 */
private String extractPrefix(ApplicationContext context,
                             ConfigurationBeanFactoryMetaData beanFactoryMetaData, String beanName,
                             Object bean) {
    ConfigurationProperties annotation = context.findAnnotationOnBean(beanName,
            ConfigurationProperties.class);
    if (beanFactoryMetaData != null) {
        ConfigurationProperties override = beanFactoryMetaData
                .findFactoryAnnotation(beanName, ConfigurationProperties.class);
        if (override != null) {
            // The @Bean-level @ConfigurationProperties overrides the one at type
            // level when binding. Arguably we should render them both, but this one
            // might be the most relevant for a starting point.
            annotation = override;
        }
    }
    return (StringUtils.hasLength(annotation.value()) ? annotation.value()
            : annotation.prefix());
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:ConfigurationPropertiesReportEndpoint.java   
private Map<String, Object> extract(ApplicationContext context, ObjectMapper mapper) {
    Map<String, Object> result = new HashMap<String, Object>();
    ConfigurationBeanFactoryMetaData beanFactoryMetaData = getBeanFactoryMetaData(
            context);
    Map<String, Object> beans = getConfigurationPropertiesBeans(context,
            beanFactoryMetaData);
    for (Map.Entry<String, Object> entry : beans.entrySet()) {
        String beanName = entry.getKey();
        Object bean = entry.getValue();
        Map<String, Object> root = new HashMap<String, Object>();
        String prefix = extractPrefix(context, beanFactoryMetaData, beanName, bean);
        root.put("prefix", prefix);
        root.put("properties", sanitize(prefix, safeSerialize(mapper, bean, prefix)));
        result.put(beanName, root);
    }
    if (context.getParent() != null) {
        result.put("parent", extract(context.getParent(), mapper));
    }
    return result;
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:ConfigurationPropertiesReportEndpoint.java   
/**
 * Extract configuration prefix from {@link ConfigurationProperties} annotation.
 * @param context the application context
 * @param beanFactoryMetaData the bean factory meta-data
 * @param beanName the bean name
 * @param bean the bean
 * @return the prefix
 */
private String extractPrefix(ApplicationContext context,
        ConfigurationBeanFactoryMetaData beanFactoryMetaData, String beanName,
        Object bean) {
    ConfigurationProperties annotation = context.findAnnotationOnBean(beanName,
            ConfigurationProperties.class);
    if (beanFactoryMetaData != null) {
        ConfigurationProperties override = beanFactoryMetaData
                .findFactoryAnnotation(beanName, ConfigurationProperties.class);
        if (override != null) {
            // The @Bean-level @ConfigurationProperties overrides the one at type
            // level when binding. Arguably we should render them both, but this one
            // might be the most relevant for a starting point.
            annotation = override;
        }
    }
    return annotation.prefix();
}
项目:spring-boot-concourse    文件:ConfigurationPropertiesReportEndpoint.java   
private Map<String, Object> extract(ApplicationContext context, ObjectMapper mapper) {
    Map<String, Object> result = new HashMap<String, Object>();
    ConfigurationBeanFactoryMetaData beanFactoryMetaData = getBeanFactoryMetaData(
            context);
    Map<String, Object> beans = getConfigurationPropertiesBeans(context,
            beanFactoryMetaData);
    for (Map.Entry<String, Object> entry : beans.entrySet()) {
        String beanName = entry.getKey();
        Object bean = entry.getValue();
        Map<String, Object> root = new HashMap<String, Object>();
        String prefix = extractPrefix(context, beanFactoryMetaData, beanName, bean);
        root.put("prefix", prefix);
        root.put("properties", sanitize(prefix, safeSerialize(mapper, bean, prefix)));
        result.put(beanName, root);
    }
    if (context.getParent() != null) {
        result.put("parent", extract(context.getParent(), mapper));
    }
    return result;
}
项目:spring-boot-concourse    文件:ConfigurationPropertiesReportEndpoint.java   
/**
 * Extract configuration prefix from {@link ConfigurationProperties} annotation.
 * @param context the application context
 * @param beanFactoryMetaData the bean factory meta-data
 * @param beanName the bean name
 * @param bean the bean
 * @return the prefix
 */
private String extractPrefix(ApplicationContext context,
        ConfigurationBeanFactoryMetaData beanFactoryMetaData, String beanName,
        Object bean) {
    ConfigurationProperties annotation = context.findAnnotationOnBean(beanName,
            ConfigurationProperties.class);
    if (beanFactoryMetaData != null) {
        ConfigurationProperties override = beanFactoryMetaData
                .findFactoryAnnotation(beanName, ConfigurationProperties.class);
        if (override != null) {
            // The @Bean-level @ConfigurationProperties overrides the one at type
            // level when binding. Arguably we should render them both, but this one
            // might be the most relevant for a starting point.
            annotation = override;
        }
    }
    return (StringUtils.hasLength(annotation.value()) ? annotation.value()
            : annotation.prefix());
}
项目:contestparser    文件:ConfigurationPropertiesReportEndpoint.java   
private Map<String, Object> extract(ApplicationContext context, ObjectMapper mapper) {
    Map<String, Object> result = new HashMap<String, Object>();
    ConfigurationBeanFactoryMetaData beanFactoryMetaData = getBeanFactoryMetaData(
            context);
    Map<String, Object> beans = getConfigurationPropertiesBeans(context,
            beanFactoryMetaData);
    for (Map.Entry<String, Object> entry : beans.entrySet()) {
        String beanName = entry.getKey();
        Object bean = entry.getValue();
        Map<String, Object> root = new HashMap<String, Object>();
        String prefix = extractPrefix(context, beanFactoryMetaData, beanName, bean);
        root.put("prefix", prefix);
        root.put("properties", sanitize(safeSerialize(mapper, bean, prefix)));
        result.put(beanName, root);
    }
    if (context.getParent() != null) {
        result.put("parent", extract(context.getParent(), mapper));
    }
    return result;
}
项目:contestparser    文件:ConfigurationPropertiesReportEndpoint.java   
/**
 * Extract configuration prefix from {@link ConfigurationProperties} annotation.
 * @param context the application context
 * @param beanFactoryMetaData the bean factory meta-data
 * @param beanName the bean name
 * @param bean the bean
 * @return the prefix
 */
private String extractPrefix(ApplicationContext context,
        ConfigurationBeanFactoryMetaData beanFactoryMetaData, String beanName,
        Object bean) {
    ConfigurationProperties annotation = context.findAnnotationOnBean(beanName,
            ConfigurationProperties.class);
    if (beanFactoryMetaData != null) {
        ConfigurationProperties override = beanFactoryMetaData
                .findFactoryAnnotation(beanName, ConfigurationProperties.class);
        if (override != null) {
            // The @Bean-level @ConfigurationProperties overrides the one at type
            // level when binding. Arguably we should render them both, but this one
            // might be the most relevant for a starting point.
            annotation = override;
        }
    }
    return (StringUtils.hasLength(annotation.value()) ? annotation.value()
            : annotation.prefix());
}
项目:ARCLib    文件:Gatherer.java   
private ConfigurationBeanFactoryMetaData getBeanFactoryMetaData(
        ApplicationContext context) {
    Map<String, ConfigurationBeanFactoryMetaData> beans = context
            .getBeansOfType(ConfigurationBeanFactoryMetaData.class);
    if (beans.size() == 1) {
        return beans.values().iterator().next();
    }
    return null;
}
项目:ARCLib    文件:Gatherer.java   
private Map<String, Object> getConfigurationPropertiesBeans(
        ApplicationContext context,
        ConfigurationBeanFactoryMetaData beanFactoryMetaData) {
    Map<String, Object> beans = new LinkedHashMap<String, Object>();
    beans.putAll(context.getBeansWithAnnotation(ConfigurationProperties.class));
    if (beanFactoryMetaData != null) {
        beans.putAll(beanFactoryMetaData
                .getBeansWithFactoryAnnotation(ConfigurationProperties.class));
    }
    return beans;
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:ConfigurationPropertiesReportEndpoint.java   
private ConfigurationBeanFactoryMetaData getBeanFactoryMetaData(
        ApplicationContext context) {
    Map<String, ConfigurationBeanFactoryMetaData> beans = context
            .getBeansOfType(ConfigurationBeanFactoryMetaData.class);
    if (beans.size() == 1) {
        return beans.values().iterator().next();
    }
    return null;
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:ConfigurationPropertiesReportEndpoint.java   
private Map<String, Object> getConfigurationPropertiesBeans(
        ApplicationContext context,
        ConfigurationBeanFactoryMetaData beanFactoryMetaData) {
    Map<String, Object> beans = new HashMap<String, Object>();
    beans.putAll(context.getBeansWithAnnotation(ConfigurationProperties.class));
    if (beanFactoryMetaData != null) {
        beans.putAll(beanFactoryMetaData
                .getBeansWithFactoryAnnotation(ConfigurationProperties.class));
    }
    return beans;
}
项目:spring-boot-concourse    文件:ConfigurationPropertiesReportEndpoint.java   
private ConfigurationBeanFactoryMetaData getBeanFactoryMetaData(
        ApplicationContext context) {
    Map<String, ConfigurationBeanFactoryMetaData> beans = context
            .getBeansOfType(ConfigurationBeanFactoryMetaData.class);
    if (beans.size() == 1) {
        return beans.values().iterator().next();
    }
    return null;
}
项目:spring-boot-concourse    文件:ConfigurationPropertiesReportEndpoint.java   
private Map<String, Object> getConfigurationPropertiesBeans(
        ApplicationContext context,
        ConfigurationBeanFactoryMetaData beanFactoryMetaData) {
    Map<String, Object> beans = new HashMap<String, Object>();
    beans.putAll(context.getBeansWithAnnotation(ConfigurationProperties.class));
    if (beanFactoryMetaData != null) {
        beans.putAll(beanFactoryMetaData
                .getBeansWithFactoryAnnotation(ConfigurationProperties.class));
    }
    return beans;
}
项目:contestparser    文件:ConfigurationPropertiesReportEndpoint.java   
private ConfigurationBeanFactoryMetaData getBeanFactoryMetaData(
        ApplicationContext context) {
    Map<String, ConfigurationBeanFactoryMetaData> beans = context
            .getBeansOfType(ConfigurationBeanFactoryMetaData.class);
    if (beans.size() == 1) {
        return beans.values().iterator().next();
    }
    return null;
}
项目:contestparser    文件:ConfigurationPropertiesReportEndpoint.java   
private Map<String, Object> getConfigurationPropertiesBeans(
        ApplicationContext context,
        ConfigurationBeanFactoryMetaData beanFactoryMetaData) {
    Map<String, Object> beans = new HashMap<String, Object>();
    beans.putAll(context.getBeansWithAnnotation(ConfigurationProperties.class));
    if (beanFactoryMetaData != null) {
        beans.putAll(beanFactoryMetaData
                .getBeansWithFactoryAnnotation(ConfigurationProperties.class));
    }
    return beans;
}
项目:spring-cloud-commons    文件:ConfigurationPropertiesRebinderAutoConfiguration.java   
@Bean
@ConditionalOnMissingBean(search = SearchStrategy.CURRENT)
public ConfigurationPropertiesBeans configurationPropertiesBeans() {
    // Since this is a BeanPostProcessor we have to be super careful not to
    // cause a cascade of bean instantiation. Knowing the *name* of the beans we
    // need is super optimal, but a little brittle (unfortunately we have no
    // choice).
    ConfigurationBeanFactoryMetaData metaData = this.context.getBean(
            ConfigurationPropertiesBindingPostProcessorRegistrar.BINDER_BEAN_NAME
                    + ".store",
            ConfigurationBeanFactoryMetaData.class);
    ConfigurationPropertiesBeans beans = new ConfigurationPropertiesBeans();
    beans.setBeanMetaDataStore(metaData);
    return beans;
}
项目:spring-cloud-commons    文件:ConfigurationPropertiesBeans.java   
/**
 * @param beans the bean meta data to set
 */
public void setBeanMetaDataStore(ConfigurationBeanFactoryMetaData beans) {
    this.metaData = beans;
}