VictorGram
VictorGram

Reputation: 2661

Spring actuator : How to use customised path check the health

I am using spring actuator with spring boot for check my service's health.I am using openJdk11. And using:

Spring-boot dependency:

'org.springframework.boot' version '2.1.3.RELEASE'

Actuator dependency:

'org.springframework.boot:spring-boot-starter-actuator:2.1.6.RELEASE'

While this is working fine, means as I try http://localhost:9000/actuator/health from the browser,getting back:

enter image description here

I need to get the same response back with :

http://localhost:9000/health

Is there way to do that?

Please let me know if more clarification is required.

Upvotes: 1

Views: 818

Answers (2)

Romil Patel
Romil Patel

Reputation: 13727

Spring Boot Actuator auto-configures all enabled endpoints to be exposed over HTTP. The default convention is to use the id of the endpoint with a prefix of /actuator as the URL path. For example, health is exposed as /actuator/health.

For example, your application might already use /actuator for another purpose. You can use the management.endpoints.web.base-path property to change the prefix for your management endpoint

management.endpoints.web.base-path=/manage

The preceding application.properties example changes the endpoint from /actuator/{id} to /manage/{id} (for example, /manage/health).

Upvotes: 2

msfoster
msfoster

Reputation: 2572

By setting the property management.endpoints.web.base-path. Read more in section 54.1 in the documentation

Upvotes: 1

Related Questions