Autowired注解

Posted zhongchang

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Autowired注解相关的知识,希望对你有一定的参考价值。

org.springframework.beans.factory.annotation.Autowired

AutowiredAnnotationBeanPostProcessor extends InstantiationAwareBeanPostProcessorAdapter 

 

public AutowiredAnnotationBeanPostProcessor() {

    this.autowiredAnnotationTypes.add(Autowired.class);

    this.autowiredAnnotationTypes.add(Value.class);

    this.autowiredAnnotationTypes.add((Class<? extends Annotation>) ClassUtils.forName("javax.inject.Inject", AutowiredAnnotationBeanPostProcessor.class.getClassLoader()));

}

 

private InjectionMetadata buildAutowiringMetadata(final Class<?>  clazz) 

 

 

AbstractAutowireCapableBeanFactory

populateBean()方法 

for (BeanPostProcessor pd : getBeanPostProcessors()) {

    if (pd instanceof InstantiationAwareBeanPostProcessor) {

          InstantiatiationAwareBeanPostProcessor ibp = (InstantiationAwareBeanPostProcessor) bp;

          pvs = ipb.postProcessPropertyValues(pvs, filteredPds, bw.etWrappedInstance(), beanName);

          if (pvs == null) {

                  return;

          }

    }

}

 

以上是关于Autowired注解的主要内容,如果未能解决你的问题,请参考以下文章

@Autowired注解

Spring中@Autowired注解@Resource注解的区别

@Autowired和@Resource注解的区别?

Spring中@Autowired注解@Resource注解的区别

spring装配之 @Autowired 和 @Resource 注解的区别

@Autowired注解详解