RequiredAnnotationBeanPostProcessor.java 文件源码

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

项目:lams 作者:
/**
 * Check whether the given bean definition is not subject to the annotation-based
 * required property check as performed by this post-processor.
 * <p>The default implementations check for the presence of the
 * {@link #SKIP_REQUIRED_CHECK_ATTRIBUTE} attribute in the bean definition, if any.
 * It also suggests skipping in case of a bean definition with a "factory-bean"
 * reference set, assuming that instance-based factories pre-populate the bean.
 * @param beanFactory the BeanFactory to check against
 * @param beanName the name of the bean to check against
 * @return {@code true} to skip the bean; {@code false} to process it
 */
protected boolean shouldSkip(ConfigurableListableBeanFactory beanFactory, String beanName) {
    if (beanFactory == null || !beanFactory.containsBeanDefinition(beanName)) {
        return false;
    }
    BeanDefinition beanDefinition = beanFactory.getBeanDefinition(beanName);
    if (beanDefinition.getFactoryBeanName() != null) {
        return true;
    }
    Object value = beanDefinition.getAttribute(SKIP_REQUIRED_CHECK_ATTRIBUTE);
    return (value != null && (Boolean.TRUE.equals(value) || Boolean.valueOf(value.toString())));
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号