fangyuan
2023-01-16 ecad870fe1896c8c3e48506d50bb5818974253bf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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());
    }
}