Gatherer.java 文件源码

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

项目:ARCLib 作者:
/**
 * 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());
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号