spring boot 2.0 WebMvcConfigurerAdapter过时

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);
    }
}

猜你喜欢

转载自blog.csdn.net/chs007chs/article/details/80915426