Spring “春云醉”;路径“:&引用/“执行机构/路线”;404找不到

Spring “春云醉”;路径“:&引用/“执行机构/路线”;404找不到,spring,cloud,netflix-zuul,Spring,Cloud,Netflix Zuul,我使用SpringCloud,我想配置Zuul zuul服务的application.yml为 server: port: 5555 #Setting logging levels logging: level: com.netflix: WARN org.springframework.web: WARN com.thoughtmechanix: DEBUG eureka: instance: preferIpAddress:

我使用SpringCloud,我想配置Zuul

zuul服务的application.yml为

server:
  port: 5555

  #Setting logging levels
logging:
    level:
      com.netflix: WARN
      org.springframework.web: WARN
      com.thoughtmechanix: DEBUG

eureka:
  instance:
    preferIpAddress: true
  client:
    registerWithEureka: true
    fetchRegistry: true
    serviceUrl:
        defaultZone: http://localhost:8761/eureka/
zuul:
  prefix:  /api
  routes:
    organizationservice: /organization/**
    licensingservice: /licensing/**
当我启动应用程序时,我在控制台中看到

zuulserver_1             | 2019-07-28 15:25:30.871  INFO 29 --- [           main] .s.c.n.e.s.EurekaAutoServiceRegistration : Updating port to 5555
zuulserver_1             | 2019-07-28 15:25:30.910  INFO 29 --- [           main] c.t.zuulsvr.ZuulServerApplication        : Started ZuulServerApplication in 99.792 seconds (JVM running for 104.442)
specialroutes-service_1  | 2019-07-28 15:25:33.222  INFO 29 --- [           **main] o.s.b.a.e.web.EndpointLinksResolver      : Exposing 2 endpoint(s) beneath base path '/actuator'
organizationservice_1    | 2019-07-28 15:25:33.936  INFO 30 --- [           main] o.s.b.a.e.web.EndpointLinksResolver      : Exposing 2 endpoint(s) beneath base path '/actuator'**
但是当我运行url时

http://192.168.1.41:5555/actuator/routes
我明白了

{
    "timestamp": "2019-07-28T15:32:14.254+0000",
    "status": 404,
    "error": "Not Found",
    "message": "No message available",
    "path": "/actuator/routes"
}
控制台中的消息是

zuulserver_1             | 2019-07-28 15:48:36.494  INFO 28 --- [nio-5555-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring DispatcherServlet 'dispatcherServlet'
zuulserver_1             | 2019-07-28 15:48:36.624 DEBUG 28 --- [nio-5555-exec-1] c.t.zuulsvr.utils.UserContextFilter      : Special Routes Service Incoming Correlation id: null

如何配置Zuul以使用/actuator/routes?

默认情况下,仅显示
/health
/info
端点

如文档所示,您需要公开端点:

因此,对于yaml文件:

management: 
  endpoints: 
    web: 
      exposure: 
        include: '*'
或者如果您只想要曝光
路线

management: 
  endpoints: 
    web: 
      exposure: 
        include: 'routes'
/exactor/routes
将可用