解决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

时间:2023-03-08 15:57:30

写项目时应用了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之前先初始化