Wednesday, October 30, 2013

Spring Boot Actuator: How to change the endpoint base url


By default, actuator management endpoints are mapped to the top level url: "/info", "/metrics", "/beans", etc.
That may be good. But probably it would be better to have some base path. For example, "/admin/metrics" or "/manage/info".
Spring Boot provides quick and easy solution.

Configuration

In your configuration resource file (application.properties or application.yml): 
management.contextPath: /admin
Now, all the management endpoints are mapped under "/admin" base path.
"/admin/metrics", "/admin/info", "/admin/health"...

Implementation Classes

In spring boot actuator source code:
  • org.springframework.boot.actuate.properties.ManagementServerProperties
    • property values representation class
  • org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration
    • @Configuration which uses above ManagementServerProperties


1 comment:

Anonymous said...

Is there an example application.xml available?