excludePathPatterns method is to exclude the access path, but when the url path you exclude does not exist in the project, springboot will program the path/error, making it impossible to proceed Exclude.
For example, the following code:
registry.addInterceptor(new MyInterceptor()).addPathPatterns("/**").excludePathPatterns("/login");
If the /login access path does not exist in the project, then when you access http://xxxx/login time, it will still be intercepted, because it becomes the error path at this time, which can also be verified through request.getRequestUrl in your custom interceptor.
But if you are using an ordinary springmvc project , it will not be intercepted at this time, but because there is no login path, the 404 page will be displayed.
You can visit it with a breakpoint to see Whether the accessed path is the same as the configured path or invalid
The above is the detailed content of How to solve the failure of springboot Interceptor interceptor excludePathPatterns ignore. For more information, please follow other related articles on the PHP Chinese website!