Step 1: Add your own filter to application.xml
Step 2: Configure filter in web.xml, which is a bit different from the previous configuration! ! !
<!-- 主的filter-->
<filter>
<filter-name>indexFilter</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
<init-param>
<param-name>targetFilterLifecycle</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>indexFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
The filter-class is the fixed org.springframework.web.filter.DelegatingFilterProxy
filter-name is the same as the id of the bean configured in application.xml!
I hope I won't do it again! ! ! ! !