重新映射 Eureka 上下文

Remapping the Eureka context

开箱即用,尤里卡在“/”处提供信息,如“http://localhost:8761/”。

是否有一种简单的方法来移动更改此上下文?比方说,我想用这个“http://localhost:8762/services”代替?

好的,我试验并弄清楚了它是如何工作的。 如果您如下更改服务器上的上下文路径,那么位于 http:/localhost:8761/services 的 ui 页面是您找到服务信息的地方。还要确保更改为此进行的测试。

server:
  port: 8761
  contextPath: /services

然后在每个服务中为客户端添加发现服务信息如下:

eureka:
  client:
    registerWithEureka: true
    fetchRegistry: true
    serviceUrl:
      defaultZone: http://localhost:8761/services/eureka/

上下文必须存在。然后就可以了