Skip to content

Commit 2ff06c3

Browse files
committed
[#4] adding authomatic routes from eureka registered services
1 parent a7391d0 commit 2ff06c3

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

SpringKubeGateway/README.MD

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@ A Spring Cloud Gateway with Kubernetes support
55

66
## info
77

8-
TBD
8+
http://localhost/simplemicroservice/hello
9+
10+
http://localhost/hello

SpringKubeGateway/src/main/kotlin/org/learning/by/example/SpringKubeGateway/SpringKubeGatewayApplication.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,22 @@ package org.learning.by.example.SpringKubeGateway
22

33
import org.springframework.boot.autoconfigure.SpringBootApplication
44
import org.springframework.boot.runApplication
5+
import org.springframework.cloud.client.discovery.DiscoveryClient
6+
import org.springframework.cloud.client.discovery.EnableDiscoveryClient
57
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder
68
import org.springframework.cloud.gateway.route.builder.routes
79
import org.springframework.context.annotation.Bean
10+
import org.springframework.cloud.gateway.discovery.DiscoveryClientRouteDefinitionLocator
11+
812

913
@SpringBootApplication
14+
@EnableDiscoveryClient
1015
class SpringKubeGatewayApplication {
1116

17+
@Bean
18+
fun discoveryClientRouteLocator(discoveryClient: DiscoveryClient) =
19+
DiscoveryClientRouteDefinitionLocator(discoveryClient)
20+
1221
@Bean
1322
fun routes(routes: RouteLocatorBuilder) = routes.routes {
1423
route {

0 commit comments

Comments
 (0)