配置SpringCloud Zuul后访问routes报404错误

    xiaoxiao2022-06-30  86

    SpringCloud版本

    <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-dependencies</artifactId> <version>Greenwich.SR1</version>

    问题

    创建zuul应用后,查看路由信息,请求地址

    http://localhost:5555/routes

    报404错误

    解决

    路由信息的地址已变更为

    http://localhost:5555/actuator/routes

    配置修改

    需要对application.yml进行相应配置

    server: port: 5555 #端口 spring: application: name: cloud-zuul # ========添加配置======= management: endpoints: web: exposure: include: "*" #注意这里*要加引号,暴露全部,也可以只暴露相应endpoint endpoint: routes: enabled: true # 默认为true,可以省略

    PS:在spring-cloud-starter-netflix-zuul中已引入了actuactor包,所以不用在pom中单独引用了。


    最新回复(0)