【发布时间】:2016-04-17 13:41:35
【问题描述】:
您好,我有以下短代码:
https://github.com/shmuel-buchnik/scope-issue
我收到以下错误:
“bean类[C]的无效属性'targetBeanName':bean属性'targetBeanName'不可写或有无效的setter方法。setter的参数类型是否与getter的返回类型匹配?”
我会很高兴理解方式。
提前致谢。
添加上下文文件以保存对 github 的访问
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd">
<bean name="a" class="A">
<property name="action" ref="c"/>
</bean>
<bean name="b" class="B" scope="prototype">
<property name="d" ref="d"/>
<aop:scoped-proxy proxy-target-class="false"/>
</bean>
<bean name="c" class="C" parent="b" scope="prototype">
<aop:scoped-proxy proxy-target-class="false"/>
</bean>
<bean name="d" class="D"/>
</beans>
【问题讨论】:
标签: spring dependency-injection spring-ioc spring-io