当前位置:网站首页>The difference between interceptors and filters

The difference between interceptors and filters

2022-07-01 08:07:00 @Overstep

The difference between filters and interceptors

  • spring mvc Our interceptor is only intercepting controller Without interception jsp,html Page file .
  • filter filter,filter Is in servlet Previously executed , You can also understand that the filter contains interceptors , A request to come , Filter first , See if the program accepts the request . After the filter is placed , The interceptor in the program .

1、 Interceptors don't depend on servlet Containers , Filter dependency ;

2、 The interceptor is based on java Reflection mechanism , Filters are based on callbacks

filter : Focus on web request ;

Interceptor : Focus on method calls ;

Spring Interceptor classification

spring There are two main types of interceptors in this system , One is HandlerInterceptor, One is MethodInterceptor.

How to achieve :
Reference article :https://blog.csdn.net/qq_46728644/article/details/120918511

原网站

版权声明
本文为[@Overstep]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202160144498389.html