拦截器相关

1.写一个拦截器的实现类,继承HandlerInterceptor

2.把拦截器加入到registry并指定路径。  registry.addInterceptor(new MyInterceptor1()).addPathPatterns("/test1/**").excludePathPatterns("/test2");  

3.自定义拦截器中实现HandlerInterceptor拦截器的接口方法preHandle,postHandle,afterCompletion

posted @ 2024-01-18 16:19  NobodyHero  阅读(2)  评论(0编辑  收藏  举报