Spring Cloud Gateway не находит микросервисы (ошибка 404 не найдена)JAVA

Программисты JAVA общаются здесь
Ответить
Гость
 Spring Cloud Gateway не находит микросервисы (ошибка 404 не найдена)

Сообщение Гость »


I have this simple microservices application with Spring Boot and I try to add the Spring Cloud Gateway service, but it doesn't work. All microservices, including the Eureka server, work well, but when I try to access to some microservice using the Gateway route, it doesn't find the microservice.

ApiGateway pom.xml

4.0.0 org.springframework.boot spring-boot-starter-parent 2.5.3 com.futurex.microservices APIGateway 0.0.1-SNAPSHOT APIGateway Demo project for Spring Boot 1.8 2020.0.3 org.springframework.cloud spring-cloud-starter-gateway org.springframework.cloud spring-cloud-starter-netflix-eureka-client org.springframework.boot spring-boot-starter-actuator org.springframework.boot spring-boot-starter-test test org.springframework.cloud spring-cloud-dependencies ${spring-cloud.version} pom import org.springframework.boot spring-boot-maven-plugin API Gateway application.yml

spring: application: name: API-GATEWAY cloud: gateway: routes: - id: FX-SERVICE1 uri: http://localhost:8005 predicates: - Path=/fx-service1/** - id: FX-SERVICE2 uri: http://localhost:8006 predicates: - Path=/fx-service2/** discovery: enabled: true config: uri: http://localhost:8081 server: port: 8081 eureka: client: service-url: defaultZone: http://localhost:8761/eureka/ register-with-eureka: true fetch-registry: true instance: hostname: localhost API Gateway main

import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.netflix.eureka.EnableEurekaClient; @SpringBootApplication @EnableEurekaClient public class ApiGatewayApplication { public static void main(String[] args) { SpringApplication.run(ApiGatewayApplication.class, args); } } Api Gateway Not found 404 error


Источник: https://stackoverflow.com/questions/686 ... -404-error
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «JAVA»