我不得不说标题中的等式让我发疯。只要我将DelegatingFilterProxy添加到web.xml,我就会收到'错误404请求的资源不可用'。否则,网络应用程序工作正常。我确定我的配置问题,但我只是想不通。我也是Spring Security的初学者......
的web.xml
</web-app ...>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/spring/security-context.xml
/WEB-INF/SpringMVC-servlet.xml
</param-value>
</context-param>
<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>
<servlet>
<servlet-name>SpringMVC</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>SpringMVC</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
安全context.xml中
<b:beans xmlns:b="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.springframework.org/schema/security" xsi:schemaLocation="http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<http auto-config="true">
<intercept-url pattern="/**" access="permitAll"/>
</http>
<authentication-manager>
<authentication-provider>
<user-service>
<user name="user" password="password" authorities="ROLE_USER" />
<user name="admin" password="password" authorities="ROLE_USER,ROLE_ADMIN"/>
</user-service>
</authentication-provider>
</authentication-manager>
</b:beans>
用SpringMVC-servlet.xml中
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd">
<import resource="spring/management-app-context.xml"/>
<mvc:annotation-driven/>
<context:component-scan base-package="org.protneut.server.management.controller" />
<mvc:resources mapping="/resources/**" location="/WEB-INF/resources/"/>
<mvc:resources mapping="/jsp/**" location="/WEB-INF/jsp/"/>
<mvc:default-servlet-handler />
<bean id="viewResolver" class="org.springframework.web.servlet.view.tiles3.TilesViewResolver"/>
<bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles3.TilesConfigurer">
<property name="definitions">
<list>
<value>/WEB-INF/tiles/tiles-definitions.xml</value>
</list>
</property>
</bean>
</beans>
因此,如果我注释掉SpringSecurityFilterChain应用程序正常工作。
在尝试打开http://localhost:8080/management-app/administration/service/main(即我的网址)时,我在应用服务器的日志文件中找不到任何日志
有人可以帮我解决问题吗? 提前谢谢!
的问候,
诉
答案 0 :(得分:4)
更改
<filter-name>SpringSecurityFilterChain</filter-name>
到
<filter-name>springSecurityFilterChain</filter-name>
两个过滤器名称标签中的