0

Today if I want to expose my custom actuator endpoint I have to added below config in application.properties

management.endpoints.web.exposure.include=info,health,myAwesomeActuator
@Component
@Endpoint(id = "myAwesomeActuator")
public class MyAwesomeActuator {

    @ReadOperation
    public String test() {
        return "Hello, from MyAwesomeActuator";
    }
}

If I don't add above config Spring Boot by default expose only /health and /info endpoints

Is there any way where I can mark my actuator as by default exposed ?

Chintan Radia
  • 236
  • 2
  • 9

1 Answers1

1

This is done for security reasons. Some endpoints can be too "vulnerable" to be exposed in production.

For development, its possible to expose all the endpoints at once by putting

management.endpoint.web.exposure.include=*

Another option is analyzing the value of the property and adding your endpoints "programmatically" before the actuator actually starts. There are many possible approaches here depending on spring boot version.

I've found this SO thread that describes the options.

One interesting option is writing an environment post processor that will analyze the property and override with your custom value, in that SO thread this option is alread mentioned.

The example of how to work with properties in the environment post processor can be seen here (again from that SO thread)

Mark Bramnik
  • 39,963
  • 4
  • 57
  • 97