原因
我除了有MyInterceptorConfig这个类继承WebMvcConfigurationSupport之外,还有一个类也继承了WebMvcConfigurationSupport,
我在MyInterceptorConfig这个类重写了
@Override protected void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor(myInterceptor).addPathPatterns("/**"); super.addInterceptors(registry); }
启动时,拦截器不生效
后来又在另外那个继承了WebMvcConfigurationSupport的类里面重写了同样的内容,拦截器生效
坑。。。。。。没事不要继承WebMvcConfigurationSupport了