I have a Spring Boot 2.7 app that runs in different environments. Depending on the environment, different actuator endpoints are exposed (development environment has all of them exposed).
The actuator base path is altered to:
management.endpoints.web.base-path=/
So, for example, the health path is:
localhost:8080/health
I have a OncePerRequestFilter that I need to not filter the actuator paths.
If I use management.endpoints.web.exposure.include, the value is * for my development environment. I can't use that for the shouldNotFilter check though.
I need an actual list, like [/info,/health,...]. I don't even need the /, as I can add that to my matcher, but it would be nice if it just had it.
Is there something that can pull the exposed actuator endpoints into a list without me having to hardcode a list?
Thanks.
You could try something like this, this also lists any extra custom endpoints you added to the actuator:
Then you can inject this as a bean wherever you need the list, for example: