Skip to content

Commit 5eb2541

Browse files
committed
gateway访问默认进入swagger文档首页
1 parent 462b0d1 commit 5eb2541

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

jeecg-boot/jeecg-cloud-module/jeecg-cloud-gateway/src/main/java/org/jeecg/config/GatewayRoutersConfiguration.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,20 @@
33
import lombok.extern.slf4j.Slf4j;
44
import org.jeecg.handler.HystrixFallbackHandler;
55
import org.springframework.beans.factory.annotation.Value;
6-
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
76
import org.springframework.context.annotation.Bean;
87
import org.springframework.context.annotation.Configuration;
98
import org.springframework.http.MediaType;
109
import org.springframework.web.reactive.function.server.RequestPredicates;
1110
import org.springframework.web.reactive.function.server.RouterFunction;
1211
import org.springframework.web.reactive.function.server.RouterFunctions;
12+
import org.springframework.web.reactive.function.server.ServerResponse;
1313

1414
import javax.annotation.Resource;
1515

16+
import static org.springframework.web.reactive.function.server.RequestPredicates.GET;
17+
import static org.springframework.web.reactive.function.server.RouterFunctions.route;
18+
import static org.springframework.web.reactive.function.server.ServerResponse.ok;
19+
1620
/**
1721
* @author scott
1822
* @date 2020/05/26
@@ -74,6 +78,11 @@ public RouterFunction routerFunction() {
7478

7579
}
7680

81+
@Bean
82+
public RouterFunction<ServerResponse> indexRouter(@Value("classpath:/META-INF/resources/doc.html") final org.springframework.core.io.Resource indexHtml) {
83+
return route(GET("/"), request -> ok().contentType(MediaType.TEXT_HTML).syncBody(indexHtml));
84+
}
85+
7786
@Resource
7887
private HystrixFallbackHandler hystrixFallbackHandler;
7988

0 commit comments

Comments
 (0)