package com.ycl.config; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @Configuration public class WebMvcConfig implements WebMvcConfigurer { @Bean public Intercept Intercept(){ return new Intercept(); } @Autowired IgnoreUrlsConfig urlsConfig; @Override public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor(this.Intercept()); // 需要验证请求路径 /*代表全部 // .addPathPatterns("/*") // .excludePathPatterns(urlsConfig.getUrls()); } }