1. addInterceptors 方法中加多条
@Configuration public class ResourcesConfig implements WebMvcConfigurer{ @Override public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor(new AppInterceptor()) .addPathPatterns("/project/**");
//这里可以加多条 } }
public class AppInterceptor implements HandlerInterceptor{ }
2. 拦截器中调用service 为空解决:
BeanFactory factory = WebApplicationContextUtils .getRequiredWebApplicationContext(request.getServletContext()); menuService = (ISysMenuService) factory .getBean("sysMenuServiceImpl");
标签:AppInterceptor,拦截器,多个,项目,factory,class,registry,public From: https://www.cnblogs.com/DarGi2019/p/17055292.html