1
- 创建interceptor类并实现org.springframework.web.servlet.HandlerInterceptor并实现其方法
- 在类上添加@Component注解

2
- 创建配置类并继承org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
- 在该类上添加 @Configuration 注解
- 实现WebMvcConfigurerAdapter类的addInterceptors方法

本文标题:SpringBoot中使用Interceptor拦截接口请求
本文链接:https://www.haomeiwen.com/subject/moonixtx.html
网友评论