lucoenergia / conluz

Conluz is an API-driven application designed for the efficient management of an energy community,enabling the administration of community members and their corresponding supply points and the retrieval of consumption, production data.
Apache License 2.0
0 stars 0 forks source link

Configure Spring Actuator #60

Closed viktorKhan closed 7 months ago

viktorKhan commented 7 months ago

To include the Actuator in your Spring Boot application using Gradle, you need to add a new dependency in the dependencies section of your build.gradle file:

dependencies {
    //...
    implementation 'org.springframework.boot:spring-boot-starter-actuator'
    //...
}

After adding this dependency, your Gradle project will have access to the Spring Boot Actuator module's features. You will still need to configure which endpoints you wish to expose via your application.properties or application.yml file as explained previously. To expose all endpoints you can add the following line:

management.endpoints.web.exposure.include=*

However, as a matter of security, it's advised only to expose endpoints you're actually going to use:

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

After making these changes, remember to restart your application. You can then access the Actuator endpoints at http://localhost:{port}/actuator/{endpointId}. Replace {port} with your application's port and {endpointId} with the id of the Actuator endpoint you want to access.

Please note that exposing sensitive endpoints (like env, beans) can leak sensitive information and should not be used in a production environment.