spring-boot - Spring Boot 2.1.6.RELEASE - 执行器不可用 HTTP 404
问题描述
尝试在 Spring Boot Web 应用程序中使用执行器。我不知道这是否重要,但 Web 应用程序作为 WAR 部署在独立的 Tomcat 9 服务器上。
我得到了以下依赖项:
...
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
...
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
<exclusions>
<exclusion>
<artifactId>tomcat-embed-el</artifactId>
<groupId>org.apache.tomcat.embed</groupId>
</exclusion>
<exclusion>
<artifactId>tomcat-embed-core</artifactId>
<groupId>org.apache.tomcat.embed</groupId>
</exclusion>
<exclusion>
<artifactId>tomcat-embed-websocket</artifactId>
<groupId>org.apache.tomcat.embed</groupId>
</exclusion>
</exclusions>
</dependency>
</dependency>
...
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<artifactId>tomcat-embed-el</artifactId>
<groupId>org.apache.tomcat.embed</groupId>
</exclusion>
<exclusion>
<artifactId>tomcat-embed-core</artifactId>
<groupId>org.apache.tomcat.embed</groupId>
</exclusion>
<exclusion>
<artifactId>tomcat-embed-websocket</artifactId>
<groupId>org.apache.tomcat.embed</groupId>
</exclusion>
</exclusions>
</dependency>
...
在 application.yml 文件中,我有:
...
management:
server:
port: 8080
address: localhost
endpoints:
web:
exposure:
include: "*"
...
Tomcat 日志文件 (catalina.out) 说:
...
2019-08-07 11:51:04.433 INFO 6913 --- [nio-8080-exec-4] o.s.b.a.e.web.EndpointLinksResolver : Exposing 15 endpoint(s) beneath base path '/actuator'
...
但是,当我转到http://localhost:8080/actuator时,我得到 404。我在这里想念什么?
提前谢谢了。
亲切的问候,
尼古拉斯
解决方案
正确的 URL 是http://host:port/war-name/actuator。
抱歉打扰了。
推荐阅读
- cordova - Cordova 构建不适用于 android 平台的 windows
- r - cronR在Shiny App定时任务中的应用
- c# - MediatR 何时以及为什么我应该使用它?
- bluetooth-lowenergy - 蓝牙 LE 'namepsace' 描述符的用途是什么?
- swift - 如何在方法签名中使用泛型协议?
- vba - 在vba中正确排序一系列值
- javascript - 如何使用powershell更改列值的格式?
- html - 调整页面大小时防止子 div 溢出其父容器
- java - 如何通过 REST API 调用获取语言详细信息?
- matplotlib - 如何在 PyQt5 中滚动浏览 numpy 数组图像?