在web.xml中将spring security的配置写完全。如果缺少上半部分,则tomcat在加载web.xml配置文件时,就加载不到spring-security.xml配置文件,所以无法根据配置生成bean。
<!--spring security-->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring/spring-security.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!--spring security过滤器-->
<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>
1万+




被折叠的 条评论
为什么被折叠?



