Springboot2.0使用的是Spring5.0,Spring5.0中WebMvcConfigurerAdapter算过时的,不再建议使用,那么我们可以使用WebMvcConfigurationSupport来代替。
@Configuration
public class TokenInterceptorConfig extends WebMvcConfigurationSupport {
@Override
protected void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(new TokenInterceptor());
super.addInterceptors(registry);
}
}