feat: 网关聚合swagger文档
This commit is contained in:
@@ -21,7 +21,7 @@ springdoc:
|
|||||||
api-docs:
|
api-docs:
|
||||||
path: /v3/api-docs
|
path: /v3/api-docs
|
||||||
group-configs:
|
group-configs:
|
||||||
- group: 'file'
|
- group: 'default'
|
||||||
paths-to-match: '/**'
|
paths-to-match: '/**'
|
||||||
packages-to-scan: com.central.file.controller
|
packages-to-scan: com.central.file.controller
|
||||||
default-flat-param-object: true
|
default-flat-param-object: true
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ springdoc:
|
|||||||
api-docs:
|
api-docs:
|
||||||
path: /v3/api-docs
|
path: /v3/api-docs
|
||||||
group-configs:
|
group-configs:
|
||||||
- group: 'user'
|
- group: 'default'
|
||||||
paths-to-match: '/**'
|
paths-to-match: '/**'
|
||||||
packages-to-scan: com.central.user.controller
|
packages-to-scan: com.central.user.controller
|
||||||
default-flat-param-object: true
|
default-flat-param-object: true
|
||||||
|
|||||||
-1
@@ -15,7 +15,6 @@ import org.springframework.stereotype.Component;
|
|||||||
@Setter
|
@Setter
|
||||||
@Getter
|
@Getter
|
||||||
@ConfigurationProperties(prefix = FileServerProperties.PREFIX)
|
@ConfigurationProperties(prefix = FileServerProperties.PREFIX)
|
||||||
@Component
|
|
||||||
public class FileServerProperties {
|
public class FileServerProperties {
|
||||||
public static final String PREFIX = "zlt.file-server";
|
public static final String PREFIX = "zlt.file-server";
|
||||||
public static final String TYPE_FDFS = "fastdfs";
|
public static final String TYPE_FDFS = "fastdfs";
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
|
|
||||||
com.central.oss.config.OssAutoConfigure
|
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
com.central.oss.config.OssAutoConfigure
|
||||||
@@ -54,10 +54,10 @@
|
|||||||
</exclusion>
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<!--<dependency>
|
||||||
<groupId>com.zlt</groupId>
|
<groupId>com.zlt</groupId>
|
||||||
<artifactId>zlt-auth-client-spring-boot-starter</artifactId>
|
<artifactId>zlt-auth-client-spring-boot-starter</artifactId>
|
||||||
</dependency>
|
</dependency>-->
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.cloud</groupId>
|
<groupId>org.springframework.cloud</groupId>
|
||||||
@@ -78,10 +78,10 @@
|
|||||||
<artifactId>knife4j-gateway-spring-boot-starter</artifactId>
|
<artifactId>knife4j-gateway-spring-boot-starter</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<!--<dependency>
|
||||||
<groupId>org.springframework.security</groupId>
|
<groupId>org.springframework.security</groupId>
|
||||||
<artifactId>spring-security-oauth2-resource-server</artifactId>
|
<artifactId>spring-security-oauth2-resource-server</artifactId>
|
||||||
</dependency>
|
</dependency>-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.baomidou</groupId>
|
<groupId>com.baomidou</groupId>
|
||||||
<artifactId>mybatis-plus-extension</artifactId>
|
<artifactId>mybatis-plus-extension</artifactId>
|
||||||
@@ -94,10 +94,6 @@
|
|||||||
<groupId>eu.bitwalker</groupId>
|
<groupId>eu.bitwalker</groupId>
|
||||||
<artifactId>UserAgentUtils</artifactId>
|
<artifactId>UserAgentUtils</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.security.oauth</groupId>
|
|
||||||
<artifactId>spring-security-oauth2</artifactId>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
+3
-3
@@ -7,7 +7,6 @@ import org.springframework.boot.web.error.ErrorAttributeOptions;
|
|||||||
import org.springframework.boot.web.reactive.error.ErrorAttributes;
|
import org.springframework.boot.web.reactive.error.ErrorAttributes;
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.security.oauth2.common.exceptions.InvalidTokenException;
|
|
||||||
import org.springframework.web.reactive.function.server.*;
|
import org.springframework.web.reactive.function.server.*;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -91,12 +90,13 @@ public class JsonErrorWebExceptionHandler extends DefaultErrorWebExceptionHandle
|
|||||||
|
|
||||||
private int getHttpStatus(Throwable error) {
|
private int getHttpStatus(Throwable error) {
|
||||||
int httpStatus;
|
int httpStatus;
|
||||||
if (error instanceof InvalidTokenException) {
|
/*if (error instanceof InvalidTokenException) {
|
||||||
InvalidTokenException ex = (InvalidTokenException)error;
|
InvalidTokenException ex = (InvalidTokenException)error;
|
||||||
httpStatus = ex.getHttpErrorCode();
|
httpStatus = ex.getHttpErrorCode();
|
||||||
} else {
|
} else {
|
||||||
httpStatus = HttpStatus.INTERNAL_SERVER_ERROR.value();
|
httpStatus = HttpStatus.INTERNAL_SERVER_ERROR.value();
|
||||||
}
|
}*/
|
||||||
|
httpStatus = HttpStatus.INTERNAL_SERVER_ERROR.value();
|
||||||
return httpStatus;
|
return httpStatus;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,12 +85,22 @@ spring:
|
|||||||
knife4j:
|
knife4j:
|
||||||
gateway:
|
gateway:
|
||||||
enabled: true
|
enabled: true
|
||||||
discover:
|
strategy: manual
|
||||||
excluded-services: ${spring.application.name}
|
routes:
|
||||||
|
- name: 用户服务
|
||||||
|
service-name: user-center
|
||||||
|
url: /api-user/v3/api-docs/default
|
||||||
|
context-path: /api-user
|
||||||
|
- name: 文件服务
|
||||||
|
service-name: file-center
|
||||||
|
url: /api-file/v3/api-docs/default
|
||||||
|
context-path: /api-file
|
||||||
|
|
||||||
|
# discover:
|
||||||
|
# version: openapi3
|
||||||
|
# excluded-services: ${spring.application.name}
|
||||||
|
|
||||||
zlt:
|
zlt:
|
||||||
swagger-agg:
|
|
||||||
generate-routes: user,file
|
|
||||||
oauth2:
|
oauth2:
|
||||||
token:
|
token:
|
||||||
store:
|
store:
|
||||||
|
|||||||
Reference in New Issue
Block a user