Eureka Application UNKNOWN问题

现在有两个服务,一个是订单服务,一个是用户服务,还有一个是Eureka服务端,现在是想要把订单服务和用户服务 注册到eureke中,但是出现了Application UNKNOW问题

导致问题的原因就是服务注册时的yml服务名称的位置问题

order服务的yml服务注册

server:
  port: 8080
spring:
  datasource:
    url: jdbc:mysql://localhost:3306/cloud_order?useSSL=false
    username: root
    password: root
    driver-class-name: com.mysql.jdbc.Driver
mybatis:
  type-aliases-package: cn.itcast.user.pojo
  configuration:
    map-underscore-to-camel-case: true
logging:
  level:
    cn.itcast: debug
  pattern:
    dateformat: MM-dd HH:mm:ss:SSS

application:
  name: orderservice #user的服务名称
eureka:
  client:
    service-url: #eureka地址信息
      defaultZone: http://127.0.0.1:1

user服务的yml服务注册

server:
  port: 8081
spring:
  datasource:
    url: jdbc:mysql://localhost:3306/cloud_user?useSSL=false
    username: root
    password: root
    driver-class-name: com.mysql.jdbc.Driver
mybatis:
  type-aliases-package: cn.itcast.user.pojo
  configuration:
    map-underscore-to-camel-case: true
logging:
  level:
    cn.itcast: debug
  pattern:
    dateformat: MM-dd HH:mm:ss:SSS

application:
    name: userservice #user的服务名称
eureka:
  client:
    service-url: #eureka地址信息
      defaultZone: http://127.0.0.1:10086/eureka

解决方法:把application: name 的服务名称放到database之前即可解决问题

问题解决

posted @ 2022-08-14 13:20  长情c  阅读(221)  评论(0)    收藏  举报