【问题标题】:why the spring ioc + struts 2 not work after add spring security 3 support为什么添加 spring security 3 支持后 spring ioc + struts 2 不起作用
【发布时间】:2011-05-13 09:31:27
【问题描述】:

我在web.xml中添加以下内容以支持spring security 3.spring ioc + struts2不起作用,当struts2指向一个bean时,系统无法搜索applicationContext.xml中的bean定义,它只是显示我的类未定义

<context-param>
     <!-- Defines definition file for security setting. -->
     <param-name>contextConfigLocation</param-name>
     <param-value>classpath:app-security.xml</param-value>
    </context-param>

    <!-- Bootstraps the Spring root web application context before servlet initialization -->
    <!-- The following code defines filter for Spring Security -->
    <listener>
         <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
    <filter>
         <filter-name>springSecurityFilterChain</filter-name>
         <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
    </filter>
    <filter-mapping>
         <filter-name>springSecurityFilterChain</filter-name>
         <url-pattern>/*</url-pattern>
    </filter-mapping>

请帮忙!提前致谢!

【问题讨论】:

  • 您需要提供更多详细信息。

标签: spring struts2 spring-security web.xml


【解决方案1】:

听起来您忘记添加一些需要的 JAR。确保您(和类加载器)可以找到它说丢失的类。 (提示:它可能是 Spring 安全 JAR 之一。)

【讨论】:

  • 但是如果我在web.xml中删除这些配置,一切正常。所以不会是jar丢失的问题
  • 你能在你的类路径中列出 spring* jars 吗?你在使用任何类型的依赖管理系统吗? (例如 Maven/Ivy)
  • 不,我们只是在构建路径中包含所有 *.jar,如果是 jar 的问题,那么一旦我删除 web.xml 中的配置,它应该不起作用,对吧?但实际上它有效!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2013-12-28
  • 2012-09-18
  • 1970-01-01
  • 1970-01-01
  • 2015-06-22
  • 2020-05-26
  • 2011-10-05
相关资源
最近更新 更多