在Spring boot 1.5.2版本中,执行器端点不能通过HTTP暴露,且与应用程序运行的端口相同。

问题描述 投票:0回答:1

我正在使用springboot 1.5.2.RELEASE版本,我试图在我的应用程序中实现spring boot actuator。我在8081端口运行我的应用程序。我只是想暴露两个端点,即健康和信息。当我尝试访问8081端口的终端点时,它没有给出结果,并在Postman中显示404 not found状态。我可以访问端口8089的健康端点,如图所示。http:/localhost:8089admininfo. 同样的事情我在8081端口也无法实现。我找过答案,但没有找到合适的 Spring boot 1.5.2 版本的答案。我的application.yml文件是这样的,我使用的是springboot 1.5.2.2版本。

management:
  context-path : /admin
  endpoints:
    web:
      exposure:
        include: health,info
    jmx:
      exposure:
        exclude: '*'
  security:
    enabled: true
  port: 8081
spring-boot spring-boot-actuator
1个回答
0
投票

如果你有你的 management.port 设为 8089那么您将只能访问该端口的管理 API。您将无法在应用程序端口访问它们 8081

如果您想在应用程序端口访问管理 API,请不要将管理 API 设置为在应用程序端口。managment.port 值,默认为与应用程序端口相同的端口。它的默认值与应用程序的端口相同。

© www.soinside.com 2019 - 2024. All rights reserved.