spring整合了struts2,struts2的拦截器加载失败
问题相关代码:[WARN ] 2021-12-11 19:49:38,854 com.opensymphony.xwork2.config.providers.InterceptorBuilder - Unable to load config class common_Interceptor at interceptor - file:/E:/java学习/Module04_BookNew_spring_mis/out/artifacts/Module04_BookNew_mis_war_exploded/WEB-INF/classes/struts_common.xml:10:80 probably due to a missing jar, which might be fine if you never plan to use the common_Interceptor interceptor
com.opensymphony.xwork2.config.ConfigurationException: Caught Exception while registering Interceptor class common_Interceptor
运行结果及报错内容
我的解答思路和尝试过的方法:在applicationContext中给这个 common_Interceptor 注册了bean,并在struts配置文件也正确引用了,依然报错找不到,或缺少jar包,包也够的
<package name="commonPackage" extends="struts-default">
<!-- 声明拦截器,必须在package开头 -->
<interceptors>
<interceptor name="common_Interceptor" class="common_Interceptor"/>
<!-- 引入拦截器栈 -->
<interceptor-stack name="MyInterceptorStack">
<!-- 引入默认拦截器 -->
<interceptor-ref name="defaultStack"/>
<!-- 引入自定义拦截器 -->
<interceptor-ref name="common_Interceptor"/>
</interceptor-stack>
</interceptors>
<!-- 可通过配置默认拦截器的方式,使拦截器对当前包下所有action生效 -->
<default-interceptor-ref name="MyInterceptorStack"/>
<global-results>
<result name="noLogin" type="redirectAction">userAction!loginPage.action</result>
</global-results>
</package>
```java
![img](https://img-mid.csdnimg.cn/release/static/image/mid/ask/691122522936118.jpg "#left")
@Component
@Scope("prototype")
public class Common_Interceptor implements Interceptor {
@Override
public void destroy() {
}
@Override
public void init() {
// BaseService.init();//初始化SqlSessionFactory
CommonSelect.initSelect();//初始化下拉列表
}
```