6.9.6 CustomAutowireConfigurer

CustomAutowireConfigurer是一个BeanFactoryPostProcessor,它允许您注册自己的自定义限定符注类型,即使它们没有使用Spring@Qualifier进行注

<bean 
        class="org.springframework.beans.factory.annotation.CustomAutowireConfigurer">
    <property name="customQualifierTypes">
        <set>
            <value>example.CustomQualifier</value>
        </set>
</property>
</bean>

AutowireCandidateResolver通过以下方式确定autowire候选者:

  • 每个Bean定义的autowire-candidate值
  • <beans />元素上可用的任何default-autowire-candidates模式
  • @Qualifier的存在以及在CustomAutowireConfigurer中注册的任何自定义注

当多个bean有资格作为autowire候选者时,“primary”的确定如下:如果候选者中只有一个bean定义的primary属性设置为true,则将选择它。

 

 

相关文章:

  • 2021-10-02
  • 2021-05-25
  • 2021-09-03
  • 2021-11-28
  • 2021-10-08
  • 2021-08-22
  • 2021-05-30
  • 2021-11-20
猜你喜欢
  • 2022-01-27
  • 2021-06-16
  • 2021-11-26
  • 2022-01-08
  • 2021-06-14
  • 2021-08-28
  • 2021-08-16
相关资源
相似解决方案