Sandeep
Sandeep

Reputation: 1401

Spring Actuator endpoints giving 404 error, except for health and info

To better understand Spring Actuator, I have created a sample Spring Initializr project, with only the following two dependencies:

  1. Spring Boot Actuator
  2. Spring Web

In my application.properties file I enabled all the endpoints that are disabled by default for web applications (as per https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-features.html#production-ready-endpoints-exposing-endpoints).

It was my expectation that I would be able to access all the actuator endpoints. However, I am getting 404s for all endpoints except http://localhost:8080/actuator/health and http://localhost:8080/actuator/info.

My application.properties file is as follows:

# Source: https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-features.html#production-ready-endpoints-exposing-endpoints

management.auditevents.enabled=true
management.endpoint.beans.enabled=true
management.endpoint.caches.enabled=true
management.endpoint.conditions.enabled=true
management.endpoint.configprops.enabled=true
management.endpoint.env.enabled=true
management.endpoint.flyway.enabled=true

# true by default
#management.endpoint.health.enabled=true

management.endpoint.heapdump.enabled=true
management.endpoint.httptrace.enabled=true

# true by default
#management.endpoint.info.enabled=true

management.endpoint.integrationgraph.enabled=true
management.endpoint.jolokia.enabled=true
management.endpoint.logfile.enabled=true
management.endpoint.loggers.enabled=true
spring.liquibase.enabled=true
management.endpoint.metrics.enabled=true
management.endpoint.mappings.enabled=true
management.endpoint.prometheus.enabled=true
management.endpoint.scheduledtasks.enabled=true
management.endpoint.sessions.enabled=true
management.endpoint.shutdown.enabled=true
management.endpoint.threaddump.enabled=true

Upvotes: 2

Views: 5664

Answers (1)

JamesN
JamesN

Reputation: 76

It looks like you need to specify endpoints to expose after enabling them.

From the docs 2.2:

* can be used to select all endpoints. For example, to expose everything over HTTP except the env and beans endpoints, use the following properties:

management.endpoints.web.exposure.include=* management.endpoints.web.exposure.exclude=env,beans

Upvotes: 6

Related Questions