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

飞火流星02027 2016-11-08 02:32:41
遇到的问题:
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

问题原因:
这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>


解决办法:
修改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">
...全文
288 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
dzd_02027 2016-11-08
  • 打赏
  • 举报
回复
http://download.csdn.net/detail/jjk_02027/9676212 http://download.csdn.net/detail/jjk_02027/9676212 楼主这个真的很牛B,里面是:struts2.5.5+spring4.3.3+hiberante5.2.真正的集成,还用集成了rest, 和hadoop的文件客户端
dzd_02027 2016-11-08
  • 打赏
  • 举报
回复
最新SSH集成_2016-11-08.txt 环境:struts2.5.5+spring4.3.3+hiberante5.2.4 真正的集成,struts action交给spring托管。真实的项目工程,带数据库初始化脚本。 楼主说得没错,我从struts2.3+spring4.1升到struts2.5+spring4.3时也碰到这上问题,struts2.5系列对各种配置的要求都比struts2.3的要严格。struts2.5一直是在进行优化。

67,542

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧