
Соответственно, Spring Cloud Gateaway имеет следующие зависимости и конфигурацию
Код: Выделить всё
4.0.0
org.springframework.boot
spring-boot-starter-parent
4.0.2
CoCT
Housing_Gateway
0.0.1-SNAPSHOT
Housing_Gateway
Housing_Gateway
17
2025.1.0
org.springframework.cloud
spring-cloud-starter-gateway-server-webflux
org.springframework.cloud
spring-cloud-starter-netflix-eureka-client
org.springframework.boot
spring-boot-starter-test
test
io.projectreactor
reactor-test
test
org.springframework.cloud
spring-cloud-dependencies
${spring-cloud.version}
pom
import
org.springframework.boot
spring-boot-maven-plugin
Код: Выделить всё
spring.application.name=Housing_Gateway
server.port=8085
spring.cloud.gateway.discovery.locator.enabled=true
spring.cloud.gateway.routes[0].id=coct_hs_budget_microservices
spring.cloud.gateway.routes[0].uri=lb://COCT_HS_BUDGET_MICROSERVICES
spring.cloud.gateway.routes[0].predicates[0]=Path=/app1/**
eureka.client.service-url.defaultZone=http://localhost:8761/eureka/
микросервисы:
Код: Выделить всё
package CoCT.CoCT_HS_Budget_Microservices;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.data.r2dbc.repository.config.EnableR2dbcRepositories;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@SpringBootApplication
public class CoCtHsBudgetMicroservicesApplication {
public static void main(String[] args) {
SpringApplication.run(CoCtHsBudgetMicroservicesApplication.class, args);
}
@RestController
class Service1Controller {
@GetMapping("/app1/hello")
public String hello() {
return "Hello From Service ";
}
}
}
Заранее благодарим.
Подробнее здесь: https://stackoverflow.com/questions/798 ... -not-found
Мобильная версия