寫項目時應用了SpringSecurity框架來進行登陸驗證,之前單獨的寫簡單的SpringSecrity的Demo時並沒有報錯,但是當和SpringMVC一起整合時卻發生了報錯
報錯如下:
Caused by: java.lang.IllegalArgumentException: A universal match pattern ('/**') is defined before other patterns in the filter chain,
causing them to be ignored.
Please check the ordering in your <security:http> namespace or FilterChainProxy bean configuration
出錯原因:
初始化配置文件發生出錯
原先初始化順序:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:spring-security.xml
classpath:applicationContext.xml
</param-value>
</context-param>
報錯
解決方法:
將applicationContext.xml在spring-security.xml之前先初始化
