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配置:
spring4的action bean配置配置
[b]解决办法:[/b]
修改spring配置为:
上面加上了autowire="no" autowire-candidate="false" ,问题解决!
另外附struts2.5.5与spring4.3.3集成的注意细节:
如果使用了struts的动态方法调用
对于struts2.5.5 package需要加上strict-method-invocation="false"
[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">