How to configure multiple microservice in route using java
I need add three services in route like given below but with java configuration. spring: cloud: gateway: mvc: routes: - id: service1 uri: http://localhost:8081/ predicates: - Path=/api/** - id: service2 uri: http://localhost:8082/ predicates: - Path=/api/** - id: service2 uri: http://localhost:8083/ predicates: - Path=/api/** - I can add one services in java like this class SimpleGateway { @Bean public RouterFunction<ServerResponse> getRoute() { return route().GET("/get", http("https://httpbin.org")); } }
but how can I add Multiple services in java? please can you add that in a document.
@Bean
public RouteLocator getRouteLocator(RouteLocatorBuilder builder) {
return builder.routes().route(r -> r.path("/t/**")
.filters(f -> f.stripPrefix(1).filter(new TimeGatewayFilter())).uri(uri)).build();
}
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.