Lius
2024-11-07 81eae83295642387de38a97fdc5a35f485307587
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
28
29
30
31
32
package org.jeecg.config;
 
import org.jeecg.config.license.LicenseCheckInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
 
import javax.annotation.Resource;
 
/**
 * @Author: lius
 * @Description: License拦截器配置
 * @DateTime: 17:55 2024/11/2
 */
@Configuration
public class LicenseConfig implements WebMvcConfigurer {
 
    @Resource
    private LicenseCheckInterceptor licenseCheckInterceptor;
 
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
 
        //添加要拦截的url
        registry.addInterceptor(licenseCheckInterceptor)
                // 拦截的路径
                .addPathPatterns("/sys/login");
                // 放行的路径
//                .excludePathPatterns("/swagger-resources/**", "/webjars/**", "/v2/**", "/swagger-ui.html/**", "/doc.html")//swagger
//                .excludePathPatterns("/base/license/**");//生成license和获取服务器硬件信息
    }
}