简体   繁体   中英

Spring-boot-actuator exposing 0 endpoints

I am trying to expose the /actuator/health endpoint in my spring-boot application, but my log states that zero endpoints are exposed. I have seen some documentation that states that the health endpoint is the only endpoint that is enabled by default but it returns 404 for me.

Log from startup of application:

{"@timestamp":"2022-06-29T09:50:59.441+02:00","@version":1,"message":"Exposing 0 endpoint(s) beneath base path '/actuator'","logger_name":"org.springframework.boot.actuate.endpoint.web.EndpointLinksResolver","thread_name":"main","level":"INFO","level_value":20000,"caller_class_name":"org.springframework.boot.actuate.endpoint.web.EndpointLinksResolver","caller_method_name":"<init>","caller_file_name":"EndpointLinksResolver.java","caller_line_number":58}

Accessing /actuator also shows that no endpoints are exposed:

{"_links":{"self":{"href":"http://localhost:8000/actuator","templated":false}}}

I've looked at several other similar posts but none of the fixes provided works for me. I do have my own endpoint as well in a @RestController that I thought might be interfering, but commenting it out its Post/Get-mappings did not help either.


My pom.xml is as follows:

<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.6.6</version>
        <relativePath />
</parent>

...

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

In my application.yaml I have tried the following:

server:
  port: 8000

management:
  health:
    probes:
      enabled: true
    livenessstate:
      enabled: true
    readinessstate:
      enabled: true

  endpoint:
    health:
      probes:
        enabled: true
      show-details: always
      enabled: true

  endpoints:
    web:
      exposure:
        include: '*'
    enabled-by-default: true

Other settings in the application.yaml (like changing the port) works fine, so I know that the application.yaml is at least being used.

Any ideas?

Since spring-boot 2x these endpoints are disabled and you need to enable them. You can try adding the following to your properties:

endpoints:
  enabled: false
  health:
    enabled: true

I also tried it via

management:
  endpoint:
    health:
      enabled: true

but that didn't work on the platform where I deployed it (WebLogic)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM