【发布时间】:2011-11-14 15:06:43
【问题描述】:
我正在尝试在旧式 xml 中执行此操作(代码)。
@Bean
@Scope(value="request", proxyMode=ScopedProxyMode.INTERFACES)
public MyInterface createInterface() {
return connectionRepository().getPrimaryConnection(MyInterface.class);
}
我试过这样做:
<bean id="myBean" class="a.b.c.MyInterface"
factory-bean="myFactory" factory-method="create"
scope="request">
<constructor-arg value="a.b.c.MyInterface"></constructor-arg>
<aop:scoped-proxy proxy-target-class="false"/>
</bean>
但我得到了:
无法转换类型的值 [$Proxy12 实现 java.io.Serializable,org.springframework.aop.scope.ScopedObject,org.springframework.aop.framework.AopInfrastructureBean,org.springframework.aop.SpringProxy,org.springframework。 aop.framework.Advised] 为属性“myBean”所需的类型 [a.b.c.MyInterface]:找不到匹配的编辑器或转换策略
有什么想法吗? 谢谢!
【问题讨论】:
标签: xml spring annotations scope request