1、配置web.xml文件: <!-- 指定spring security的配置文件--> <context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/spring-security.xml</param-value> </context-param> <!-- spring security 的 Filter Chain 代理 --> <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的Context --> <listener> <listener-class> org.springframework.web.context.ContextLoaderListener </listener-class> </listener> 2、配置spring-security.xml(该文件名字与web.xml中的<context-param />中的