springboot 拦截器的使用

1、自定义拦截器 实现HandlerInterceptor接口、重写拦截器方法

springboot 拦截器的使用

2、配置拦截器,通过@Configuration自定义配置类 ,实现WebMvcConfigurer接口 , 重写添加拦截器的方法addInterceptors()

 springboot 拦截器的使用

3、WebMvcConfigurer的方法

 springboot 拦截器的使用