Configuration - Subham95-git/spring-cloud-gateway GitHub Wiki
server:
port: 8093
spring:
application: name: cloud-gateway cloud: gateway: routes: - id: Microservice1 uri: http://localhost:8091/ predicates: - Path=/serviceA/** - id: Microservice2 uri: http://localhost:8092/ predicates: - Path=/serviceB/**
-
Requests to localhost:8093/serviceA/** → Microservice1 (localhost:8091/)
-
Requests to localhost:8093/serviceB/** → Microservice2 (localhost:8092/)
plugins {
id 'java' id 'org.springframework.boot' version '3.5.0' id 'io.spring.dependency-management' version '1.1.7'
}
group = ‘com.demo’ version = ‘0.0.1-SNAPSHOT’
java {
toolchain { languageVersion = JavaLanguageVersion.of(21) }
}
repositories {
mavenCentral()
}
ext {
set('springCloudVersion', "2025.0.0")
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-webflux' implementation 'org.springframework.cloud:spring-cloud-starter-gateway-server-webflux' testImplementation 'org.springframework.boot:spring-boot-starter-test' testImplementation 'io.projectreactor:reactor-test' testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}
dependencyManagement {
imports { mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}" }
}
tasks.named(‘test’) {
useJUnitPlatform()
}