Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring Boot 2 health actuator default mapping

I'm using Spring Boot 2 M3 actuators. By default, the health endpoint is mapped to /application/health.

  • Is it possible to change this path to /health?
like image 722
Boni García Avatar asked Sep 22 '17 11:09

Boni García


People also ask

Is Spring Boot actuator enabled by default?

In order to access the actuator endpoints using HTTP, we need to both enable and expose them. By default, all endpoints but /shutdown are enabled.

Which of the following actuator endpoints is enabled by default?

By default base-path of actuator endpoints is /actuator , we can change it to any other value by setting management. endpoints. web. base-path in application properties file.

How do I enable actuator health in Spring Boot application?

To enable Spring Boot actuator endpoints to your Spring Boot application, we need to add the Spring Boot Starter actuator dependency in our build configuration file. Maven users can add the below dependency in your pom. xml file. Gradle users can add the below dependency in your build.

Which of the following endpoints in the actuators will be enabled by default in the Spring Boot MVC applications?

The application runs on port 8080 by default. Once the actuator has started, we can see the list of all the endpoints exposed over HTTP.


2 Answers

In your application.properties file add this to set the base path to '/'

management.endpoints.web.base-path=/

Path will now be '/health'

Edit: Alternatively if you are using YAML use:

management:
  endpoints:
    web:
      base-path: /
like image 76
Sophia Price Avatar answered Sep 19 '22 21:09

Sophia Price


FYI as of Spring Boot 2.0.0.RELEASE the default health endpoint is /actuator/health

like image 35
Taylor Gautier Avatar answered Sep 22 '22 21:09

Taylor Gautier