当前位置: 首页 > 知识库问答 >
问题:

Spring执行器未映射到本地主机:xxxx/执行器

缪兴腾
2023-03-14

我有一个Spring Boot应用程序,其中包括Spring Actuator在pom.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检查endpoint时,我的浏览器显示

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

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

共有1个答案

范兴文
2023-03-14

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

https://cloud.spring.io/spring-cloud-consul/reference/html/#registering-管理即服务

试着称之为:

http://localhost:8080/actuator

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

http://localhost:{port}/actuator
 类似资料:
  • 我正在尝试用Spring Boot管理服务器安装Spring执行器。在我的本地机器工作良好,但在openshift云我有一些问题... 拜托,有人能帮帮我吗?谢谢!

  • 在spring中,我们可以设计rest web服务,如下所示。 谁能帮忙吗?

  • 我用的是Spring靴2 M3执行器。默认情况下,健康endpoint映射到。 是否可以将此路径更改为?

  • 我在Tomcat 8上使用Spring 4 WebSocket,我有以下配置: 我的Spring控制器具有以下方法: 所以我在这里尝试做的是,如果客户端1想要向客户端2发送消息,他将使用。然后,Spring控制器将消息推送到主题。 我在客户端中编写了以下代码: 连接工作正常,只是我的应用程序的上下文根。 我的客户端中还有以下代码用于发送消息: 两个变量(和)都是可访问的,我没有从这部分代码中得到任

  • 我有一个包含240个项目的列表,使用完整发送此列表需要1个多小时。 所以我跟着这篇文章同时发送,以尽量减少响应时间,但是里面的代码永远不会执行:

  • 如何访问http://localhost:8081/Actuatorendpoint?