Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[update] 线上环境不打印网关日志 #36

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package vip.mate.core.web.config;

import com.github.xiaoymin.knife4j.spring.extension.OpenApiExtensionResolver;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
Expand All @@ -15,7 +16,11 @@
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.*;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.ApiKey;
import springfox.documentation.service.AuthorizationScope;
import springfox.documentation.service.Contact;
import springfox.documentation.service.SecurityReference;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spi.service.contexts.SecurityContext;
import springfox.documentation.spring.web.paths.DefaultPathProvider;
Expand Down Expand Up @@ -53,7 +58,9 @@ public class SwaggerConfiguration implements WebMvcConfigurer {

private final MateSwaggerProperties swaggerProperties;

@Bean
private final OpenApiExtensionResolver openApiExtensionResolver;

@Bean
public PathProvider pathProvider() {
return new DefaultPathProvider() {
@Override
Expand Down Expand Up @@ -98,7 +105,9 @@ public Docket createRestApi() {
.securityContexts(securityContexts())
.pathProvider(pathProvider())
.ignoredParameterTypes(ignoredParameterTypes)
.pathMapping("/");
.pathMapping("/")
.groupName(MateConstant.MATE_APP_VERSION)
.extensions(openApiExtensionResolver.buildExtensions(MateConstant.MATE_APP_VERSION));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
import org.springframework.cloud.gateway.filter.GlobalFilter;
import org.springframework.context.annotation.Profile;
import org.springframework.core.Ordered;
import org.springframework.http.HttpHeaders;
import org.springframework.http.server.reactive.ServerHttpResponse;
Expand All @@ -26,6 +27,7 @@
@Slf4j
@Component
@AllArgsConstructor
@Profile({"!prod"})
public class RequestLogFilter implements GlobalFilter, Ordered {

private static final String START_TIME = "startTime";
Expand Down