hibernate 错误:getaddrinfo EAI_Again餐饮服务,云网关404错误

mec1mxoz  于 2022-11-14  发布在  其他
关注(0)|答案(1)|浏览(153)

我用Spring Boot做了一个微服务。我正在使用Eureka、Hystrix和Cloud Gateway
我的云网关应用程序.yml是:-

```spring:
       application:
       name: GATEWAY-SERVICE
       cloud:
       gateway:
       routes:
       - id: order-service
        uri: lb://ORDER-SERVICE
        predicates:
      - Path=/order/**
       filters:
       - name: CircuitBreaker
        args:
          name: order-service
          fallbackuri: forward:/orderFallBack
      - id: res-service
    uri: lb://RESTAURANT-SERVICE
    predicates:
      - Path=/res/**
    filters:
      - name: CircuitBreaker
        args:
          name: res-service
          fallbackuri: forward:/restaurantFallBack
          
   eureka:
   client:
  fetch-registry: true
  register-with-eureka: true
  serviceUrl:
   defaultZone: http://localhost:8761/eureka/
  instance:
  preferIpAddress: true      
 server:
 port: 8988

management:
 endpoints:
  web:
   exposure:
    include: hystrix.stream
    
 hystrix:
  command:
    fallbackcmd:
      execution:
     isolation:
      thread:
        timeoutInMilliseconds: 5000  ```

我的Eureka应用程序.yml是:

```server:
       port: 8761

      eureka:
      client:   
     register-with-eureka: false
      fetch-registry: false```

我的RESTAARANT服务的Application.Properties...请注意,我没有使用Application.yml

```server.port:8086

       spring.zipkin.base-url:http://localhost:9411/
         spring.application.name:RESTAURANT-SERVICE
           spring.datasource.url:jdbc:mysql://127.0.1.1:3307/SpringBoot201
            spring.datasource.username=root
         spring.datasource.password=
            spring.jpa.hibernate.ddl-auto=update
                eureka.client.fetch-registry: true
          eureka.client.register-with-eureka: true
            eureka.client.serviceUrl.defaultZone: http://localhost:8761/eureka/
              eureka.client.serviceUrl.instance.preferIpAddress: true```

我的orderManagement Service Application.Properties是:-

```server.port:8087

                  spring.zipkin.base-url:http://localhost:9411/
                      spring.application.name:ORDER-SERVICE
                   spring.datasource.url:jdbc:mysql://127.0.1.1:3307/SpringBoot201
                  spring.datasource.username=root
                  spring.datasource.password=
                   spring.jpa.hibernate.ddl-auto=update
                 eureka.client.fetch-registry: true
                eureka.client.register-with-eureka: true
            eureka.client.serviceUrl.defaultZone: http://localhost:8761/eureka/
           eureka.client.serviceUrl.instance.preferIpAddress: true```

当我发送订单服务或餐饮服务请求时,我在 Postman PostMan Showing Error中收到此错误
我的Eureka 显示这个Eureka 工作正常
但是当我打开Cloud Gateway时,它会显示这个Cloud Gateway 404 error

zpf6vheq

zpf6vheq1#

APPLICATION.YML或APPLICATION.Properties中没有错误。实际上,在订单服务的控制器部分和餐馆服务的控制器部分,我需要添加@RequestMap(“/Order”)@RequestMap(“/res”),就像在Applation.yml中提到的那样

  • PATH=/ORDER/**-PATH=/RES/**表示应以以下内容开头

相关问题