Search code examples
javaspringspring-bootspring-boot-actuator

How to enable custom actuator endpoint for a child project?


I'm trying to enable custom endpoint for a project that's inside other project.

I have a parent project with its pom.xml, then inside that project I have zuul-gateway project which has its own pom.xml with the parent set to parent project.

I do everything correctly in terms of enabling custom endpoint because I've tried the solution on a standalone project (no child-parent relationship) and it works, but when I try to use it in a child project the endpoint gets ignored.

web:
  exposure:
    include: info, health, metrics, microservices-health

The three metrics before (info, health, metrics) my custom one (microservices-health) get mapped correctly to actuator, while my custom one gets completely ignored.

EDIT: the spring boot version used is 2.0.x


Solution

  • I've fixed it. The problem was that the starting class was inside the /boot directory and the component scan didn't scan anything inside /actuator directory then. When I moved ZuulApp (starting class) a level above, it mapped correctly.