不继承WebMvcConfigurationSupport,改为实现WebMvcConfigurer接口
@Configuration public class WebInterceptor implements WebMvcConfigurer { @Override public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor(new UserHandlerInterceptor()). addPathPatterns("/**") .excludePathPatterns( "/login" ); } }