Skip to content

Commit

Permalink
gateway访问默认进入swagger文档首页
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangdaiscott committed Mar 4, 2021
1 parent 462b0d1 commit 5eb2541
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,20 @@
import lombok.extern.slf4j.Slf4j;
import org.jeecg.handler.HystrixFallbackHandler;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
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.reactive.function.server.ServerResponse;

import javax.annotation.Resource;

import static org.springframework.web.reactive.function.server.RequestPredicates.GET;
import static org.springframework.web.reactive.function.server.RouterFunctions.route;
import static org.springframework.web.reactive.function.server.ServerResponse.ok;

/**
* @author scott
* @date 2020/05/26
Expand Down Expand Up @@ -74,6 +78,11 @@ public RouterFunction routerFunction() {

}

@Bean
public RouterFunction<ServerResponse> indexRouter(@Value("classpath:/META-INF/resources/doc.html") final org.springframework.core.io.Resource indexHtml) {
return route(GET("/"), request -> ok().contentType(MediaType.TEXT_HTML).syncBody(indexHtml));
}

@Resource
private HystrixFallbackHandler hystrixFallbackHandler;

Expand Down

0 comments on commit 5eb2541

Please sign in to comment.