fangyuan
2022-11-22 b1516fedd7deedb61641321158fce862f77b4b4d
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());
    }
}