0

我有一个 Spring Boot 应用程序,其中包含 Spring Actuatorpom.xml

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

我的配置是这样的

management:
  server:
    port: 8200
  endpoints:
    web:
      exposure:
        include: "*"
  endpoint:
    health:
      show-details: always
    metrics:
      enabled: false
  metrics:
    tags:
      application: ${my.application.name}
  health:
    jms:
      enabled: false

但是,当我尝试使用 检查端点时localhost:8200/actuator,我的浏览器显示

This site can’t be reached
localhost refused to connect.

在我的 IntelliJ IDEA 中,我可以看到执行器选项卡,它似乎在那里工作,但没有 URL 映射。有人可以帮忙吗?

4

1 回答 1

0

在您的 yml 配置中,您已将管理服务器端口设置为 8200 而不是您的应用程序端口。因此,您仍然需要连接到您的应用程序端口(应该是 8080,除非您已将其设置为其他端口)以对您的应用程序进行健康检查。

https://cloud.spring.io/spring-cloud-consul/reference/html/#registering-management-as-a-separate-service

试着这样称呼它:

http://localhost:8080/actuator

或者,如果您更改了端口:

http://localhost:{port}/actuator
于 2021-08-28T09:57:53.260 回答