Spring Boot 2.1.6.RELEASE-执行器不可用HTTP 404

时间:2019-08-07 10:11:38

标签: spring-boot spring-boot-actuator tomcat9

尝试在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。我在这里想念什么?

非常感谢。

亲切的问候,

尼古拉斯

1 个答案:

答案 0 :(得分:1)

正确的URL为http://host:port/war-name/actuator

很抱歉。