Java 接口代理模式和@Qualifier不';行不通
为什么在使用Java 接口代理模式和@Qualifier不';行不通,java,spring,spring-aop,Java,Spring,Spring Aop,为什么在使用@Qualifier和接口代理模式时出现异常 创建名为“aopTest.TestBeanContainer”的bean时出错:未满足 通过字段“beanA”表示的依赖关系;嵌套异常是 org.springframework.beans.factory.noSuchBean定义异常:否 “pl.springui.components.HTMLRenderer”类型的限定bean 可用:至少需要1个符合autowire条件的bean 候选人依赖项批注: {@org.springframe
@Qualifier
和接口代理模式时出现异常
创建名为“aopTest.TestBeanContainer”的bean时出错:未满足
通过字段“beanA”表示的依赖关系;嵌套异常是
org.springframework.beans.factory.noSuchBean定义异常:否
“pl.springui.components.HTMLRenderer”类型的限定bean
可用:至少需要1个符合autowire条件的bean
候选人依赖项批注:
{@org.springframework.beans.factory.annotation.Qualifier(value=a),
@org.springframework.beans.factory.annotation.Autowired(required=true)}
当我将@Qualifier
更改为@Primary
时,我没有得到任何异常,但在同一对象上执行test()
方法时,会创建一个新的beanA
test executed:
NEW:BeanA [id=5]
BeanA [id=5] |$Proxy27
test executed:
NEW:BeanA [id=6]
BeanA [id=6] |$Proxy27
test executed:
NEW:BeanA [id=5]
BeanA [id=5] |$Proxy27
test executed:
NEW:BeanA [id=6]
BeanA [id=6] |$Proxy27