Home > Blockchain >  Exposing Spring boot actuator endpoints
Exposing Spring boot actuator endpoints

Time:07-27

I am trying to expose Spring boot actuator endpoints env and info.

I have a very basic demo application and don't have Spring security in my classpath.

I am on 2.7.1 spring boot version.

I have added this property in the app.properties file

management.endpoints.web.exposure.include=env,info

In the pom.xml i added

    <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

But i don't get the endpoints at /env and /info. Instead i get 404.

I followed this SO post /actuator/info Endpoint not working with spring boot 2.5.0 but it also did not help much.

UPDATE

It worked if i lowered the spring boot version to 2.4.3 and corresponding spring cloud dependencies.

Not sure what is the issue with my current version 2.7.1 Best Regards,

Saurav

CodePudding user response:

First try to see if the endpoint /actuator returns some content. If it does not return anything, then the actuator is not correctly plugged in and there might be some dependency issue or version missmatch in your project.

If /actuator returns a response, then you can try the following:

Although the following properties are by default set to true there might be some complex configuration that disables those endpoints for your project.

Try to set them to enabled by explicitly stating this in application.properties.

management.endpoints.web.exposure.include=info,env
management.endpoint.env.enabled=true
management.endpoint.info.enabled=true 
  • Related