报错的配置
@Configuration
public class InterceptorConfig extends WebMvcConfigurerAdapter {
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(new DemoInterceptor());
}
}
ok的配置
@Component
public class DemoInterceptor implements HandlerInterceptor {
}
@Configuration
public class InterceptorCongif extends WebMvcConfigurerAdapter {
@Autowired
DemoInterceptor demoInterceptor;
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(demoInterceptor);
}
}
doc
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。