|
|
@@ -18,24 +18,16 @@ package org.springblade.gateway.config;
|
|
|
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.springblade.gateway.handler.SwaggerResourceHandler;
|
|
|
-import org.springblade.gateway.handler.SwaggerSecurityHandler;
|
|
|
-import org.springblade.gateway.handler.SwaggerUiHandler;
|
|
|
import org.springblade.gateway.props.AuthProperties;
|
|
|
-import org.springblade.gateway.props.RouteProperties;
|
|
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
|
|
import org.springframework.context.annotation.Bean;
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
import org.springframework.http.HttpHeaders;
|
|
|
import org.springframework.http.HttpMethod;
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
-import org.springframework.http.MediaType;
|
|
|
import org.springframework.http.server.reactive.ServerHttpRequest;
|
|
|
import org.springframework.http.server.reactive.ServerHttpResponse;
|
|
|
import org.springframework.web.cors.reactive.CorsUtils;
|
|
|
-import org.springframework.web.reactive.function.server.RequestPredicates;
|
|
|
-import org.springframework.web.reactive.function.server.RouterFunction;
|
|
|
-import org.springframework.web.reactive.function.server.RouterFunctions;
|
|
|
import org.springframework.web.server.ServerWebExchange;
|
|
|
import org.springframework.web.server.WebFilter;
|
|
|
import org.springframework.web.server.WebFilterChain;
|
|
|
@@ -49,13 +41,9 @@ import reactor.core.publisher.Mono;
|
|
|
@Slf4j
|
|
|
@Configuration
|
|
|
@AllArgsConstructor
|
|
|
-@EnableConfigurationProperties({RouteProperties.class, AuthProperties.class})
|
|
|
+@EnableConfigurationProperties({AuthProperties.class})
|
|
|
public class RouterFunctionConfiguration {
|
|
|
|
|
|
- private final SwaggerResourceHandler swaggerResourceHandler;
|
|
|
- private final SwaggerSecurityHandler swaggerSecurityHandler;
|
|
|
- private final SwaggerUiHandler swaggerUiHandler;
|
|
|
-
|
|
|
/**
|
|
|
* 这里为支持的请求头,如果有自定义的header字段请自己添加
|
|
|
*/
|
|
|
@@ -90,14 +78,4 @@ public class RouterFunctionConfiguration {
|
|
|
};
|
|
|
}
|
|
|
|
|
|
- @Bean
|
|
|
- public RouterFunction routerFunction() {
|
|
|
- return RouterFunctions.route(RequestPredicates.GET("/swagger-resources")
|
|
|
- .and(RequestPredicates.accept(MediaType.ALL)), swaggerResourceHandler)
|
|
|
- .andRoute(RequestPredicates.GET("/swagger-resources/configuration/ui")
|
|
|
- .and(RequestPredicates.accept(MediaType.ALL)), swaggerUiHandler)
|
|
|
- .andRoute(RequestPredicates.GET("/swagger-resources/configuration/security")
|
|
|
- .and(RequestPredicates.accept(MediaType.ALL)), swaggerSecurityHandler);
|
|
|
- }
|
|
|
-
|
|
|
}
|