Zuul settings in the application.yml doesn't work, just showing 404

22 views Asked by At

The Enreka center is ok (https://i.stack.imgur.com/sITP9.png). And I can invoke the api directly (https://i.stack.imgur.com/dpVVd.png). But if I invoke by the gateway,it shows error (https://i.stack.imgur.com/Stq6p.png).JDK is 17.

 pom.xml:
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-eureka</artifactId>
        <version>1.4.7.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-zuul</artifactId>
        <version>1.4.7.RELEASE</version>
    </dependency>

application.yml:
  zuul:
    routes:
      eureka-client.path: /dept/**
      eureka-client.serviceId: eureka-client
  ribbon:
    eureka:
      enabled: true
  eureka:
    client:
      serviceUrl:
        defaultZone: http://localhost:8761/eureka/
  server:
    port: 8080
  spring:
    application:
      name: gateway

GateWayApplication.java:

@SpringBootApplication
@EnableZuulProxy
@EnableDiscoveryClient
public class GateWayApplication {
 
    public static void main(String[] args) {
        SpringApplication.run(GateWayApplication.class, args);
    }
}

I have tried my times ,but still failed.Any good man can help me? Thanks a lot.

0

There are 0 answers