Mastering Spring Boot 2.0
上QQ阅读APP看书,第一时间看更新

Changing endpoint IDs

As you have seen in the table of all Actuator endpoints, each of the Actuator endpoints has an ID that is used to call that endpoint as a REST service. For example /health, /metrics, and /beans endpoints have health, metrics, and beans, respectively, as their IDs. But you can change this endpoint ID and set what you want for your application as follows:

endpoints.endpoint-id.id=new_id 

For example, let's customize the ID of the /health endpoint. Now I want to change it to GET requests sent to /status. In the application.properties file, it looks like this:

health.id = status 

In the application.yml file, it looks like this:

health:
   id: status 

Now you can check the health of your application by using the /status custom endpoint. It will work the same as the /health endpoint.