|
|
@ -1,14 +1,19 @@
|
|
|
|
package com.supervision.config;
|
|
|
|
package com.supervision.config;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
|
|
|
|
import org.springframework.core.env.Environment;
|
|
|
|
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
|
|
|
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
|
|
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
|
|
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
|
|
@Configuration
|
|
|
|
@Configuration
|
|
|
|
|
|
|
|
@RequiredArgsConstructor
|
|
|
|
public class WebConfig implements WebMvcConfigurer {
|
|
|
|
public class WebConfig implements WebMvcConfigurer {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final Environment environment;
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void addInterceptors(InterceptorRegistry registry) {
|
|
|
|
public void addInterceptors(InterceptorRegistry registry) {
|
|
|
@ -20,13 +25,6 @@ public class WebConfig implements WebMvcConfigurer {
|
|
|
|
|
|
|
|
|
|
|
|
public List<String> ignorePathPatterns() {
|
|
|
|
public List<String> ignorePathPatterns() {
|
|
|
|
List<String> paths = new ArrayList<>();
|
|
|
|
List<String> paths = new ArrayList<>();
|
|
|
|
paths.add("/swagger-resources/**");
|
|
|
|
|
|
|
|
paths.add("/webjars/**");
|
|
|
|
|
|
|
|
paths.add("/v3/**");
|
|
|
|
|
|
|
|
paths.add("/swagger-ui.html/**");
|
|
|
|
|
|
|
|
paths.add("/swagger-ui/**");
|
|
|
|
|
|
|
|
paths.add("/webjars/");
|
|
|
|
|
|
|
|
paths.add("/doc.html/**");
|
|
|
|
|
|
|
|
paths.add("/error");
|
|
|
|
paths.add("/error");
|
|
|
|
paths.add("/favicon.ico");
|
|
|
|
paths.add("/favicon.ico");
|
|
|
|
paths.add("/user/login");
|
|
|
|
paths.add("/user/login");
|
|
|
@ -34,8 +32,18 @@ public class WebConfig implements WebMvcConfigurer {
|
|
|
|
paths.add("/minio/uploadFile");
|
|
|
|
paths.add("/minio/uploadFile");
|
|
|
|
paths.add("/user/changePassWord");
|
|
|
|
paths.add("/user/changePassWord");
|
|
|
|
paths.add("/fileManage/downloadFile");
|
|
|
|
paths.add("/fileManage/downloadFile");
|
|
|
|
// 开发环境,放开不校验token.每次修改这里需要重启(热部署不行)
|
|
|
|
|
|
|
|
// paths.add("/**");
|
|
|
|
// 开发环境放开swagger
|
|
|
|
|
|
|
|
long count = Arrays.stream(environment.getActiveProfiles()).filter("dev"::equals).count();
|
|
|
|
|
|
|
|
if (count > 0){
|
|
|
|
|
|
|
|
paths.add("/swagger-resources/**");
|
|
|
|
|
|
|
|
paths.add("/webjars/**");
|
|
|
|
|
|
|
|
paths.add("/v3/**");
|
|
|
|
|
|
|
|
paths.add("/swagger-ui.html/**");
|
|
|
|
|
|
|
|
paths.add("/swagger-ui/**");
|
|
|
|
|
|
|
|
paths.add("/webjars/");
|
|
|
|
|
|
|
|
paths.add("/doc.html/**");
|
|
|
|
|
|
|
|
}
|
|
|
|
return paths;
|
|
|
|
return paths;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|