我已将我的Struts从版本2.3.4.1更新到版本2.3.15,原因是TokenInterceptor
问题(双重提交时无效的令牌问题)。
我在项目中使用Spring 3.1.1进行依赖注入。
更新Struts后,为什么会出现以下问题?
代码:
Error building bean
**org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.apache.struts2.interceptor.TokenSessionStoreInterceptor': Unsatisfied dependency expressed through bean property 'textProvider': : No unique bean of type [com.opensymphony.xwork2.TextProvider] is defined: expected single matching bean but found 78**: [...
**Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.opensymphony.xwork2.TextProvider] is defined: expected single matching bean but found 78:** [...
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.apache.struts2.interceptor.TokenSessionStoreInterceptor': Unsatisfied dependency expressed through bean property 'textProvider': : No unique bean of type [com.opensymphony.xwork2.TextProvider] is defined: expected single matching bean but found 78: ...
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:1199) ~[spring-beans-3.1.1.RELEASE.jar:3.1.1.RELEASE]
答案 0 :(得分:0)
这是因为弹簧自动接线能力。 它无法准确找到要为TextProvider注入的类,因为struts库中有两种这样的对象。
只需尝试将struts主要属性文件(struts.objectFactory.spring.autoWire
)中struts.properties
参数的值更改为“name”。
struts.objectFactory.spring.autoWire=name
我希望它适用于U;)