struts2.5.5与spring3.4.4集成报错:Unable to load config class I18nInterceptor

struts2.5.5与spring3.4.4集成报错:Unable to load config class I18nInterceptor

[b]遇到的问题:[/b]
Unable to load config class org.apache.struts2.interceptor.I18nInterceptor at interceptor

org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type [com.opensymphony.xwork2.LocaleProvider] is defined:

Unable to create a Configuration, because no Bean Validation provider could be found. Add a provider like Hibernate Validator (RI) to your classpath

[b]问题原因:[/b]
这struts2的配置和spring4的action bean配置有关
struts2配置:
<constant name="struts.objectFactory.spring.autoWire" value="type" />

spring4的action bean配置配置
<bean id="dicCBBAction" class="com.asiainfo.migration.struts2.action.cbb.DictionaryCBBAction" scope="prototype">
<property name="dataService">
<ref bean="tPubDictionaryService" />
</property>
</bean>


[b]解决办法:[/b]
修改spring配置为:
<bean id="dicCBBAction" class="com.asiainfo.migration.struts2.action.cbb.DictionaryCBBAction" autowire="no" autowire-candidate="false" scope="prototype">
<property name="dataService">
<ref bean="tPubDictionaryService" />
</property>
</bean>


上面加上了autowire="no" autowire-candidate="false" ,问题解决!

另外附struts2.5.5与spring4.3.3集成的注意细节:
如果使用了struts的动态方法调用
]<constant name="struts.enable.DynamicMethodInvocation" value="true" />[/

对于struts2.5.5 package需要加上strict-method-invocation="false"
<package name="admin" namespace="/admin" extends="struts-default" strict-method-invocation="false">
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值