How to enable all endpoints in actuator Spring Boot 2.0.0 RC1
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.
Spring Boot Actuator is a powerful set of tools that help in monitoring and managing Spring Boot applications. Actuator offers several endpoints that expose various details about the application, which are particularly useful for operations or for debugging purposes. By default, only a limited set of actuator endpoints are enabled. In Spring Boot 2.0.0 RC1, enabling all actuator endpoints requires some configuration changes. This article provides a detailed guide on how to do so, enriched with technical explanations and examples.
Enabling All Actuator Endpoints
Since Spring Boot 2.0, the Actuator endpoints are secured by default and require explicit activation. Here is a step-by-step guide on how to enable all actuator endpoints in your Spring Boot application:
Step 1: Add Actuator Dependency
Firstly, ensure that the Spring Boot Actuator dependency is included in your project. If you're using Maven, add the following dependency to your pom.xml:
For Gradle, add the following line to your build.gradle:
Step 2: Configure Application Properties
In Spring Boot, application configuration is typically controlled via application.properties or application.yml. To enable all endpoints, you need to configure these files appropriately.
Using application.properties:
Add the following line to your application.properties file:
This configuration exposes all available actuator endpoints over HTTP.
Using application.yml:
Alternatively, you can configure your endpoints using application.yml:
This YAML configuration achieves the same result as the properties configuration by including all endpoints.
Step 3: Security Considerations
Exposing all actuator endpoints can potentially expose sensitive operational data. It's crucial to secure these endpoints to prevent unauthorized access. Spring Boot provides security integration that is straightforward to set up:
Securing Actuator Endpoints
If security is enabled in your Spring Boot application, you will need to ensure that these endpoints are protected. An example of securing actuator endpoints using Spring Security can be achieved by updating your security configuration:
The above code ensures that actuator endpoints require authentication for access.
Sample Endpoint Usage
Once you've configured and secured your endpoints, you can access them by navigating to http://localhost:8080/actuator. Below is a list of common endpoints you might find useful:
| Endpoint | Description |
/health | Shows application health information (e.g., UP) |
/info | Displays arbitrary application info from properties |
/metrics | Exposes metrics information about the current application |
/env | Provides access to properties in Spring's Environment |
Enhance Monitoring with Custom Metrics
In addition to enabling default endpoints, you can create your own custom metrics. For instance:
Conclusion
Enabling and configuring actuator endpoints in Spring Boot 2.0.0 RC1 is a straightforward process but requires careful security considerations. With these capabilities, you can gain insights into your application's health and performance, making it easier to administer and monitor.
Summary Table
| Configuration File | Key Configuration | Description |
application.properties | management.endpoints.web.exposure.include=* | Exposes all endpoints over HTTP |
application.yml | include: '*' under management.endpoints.web | YAML equivalent for exposing all endpoints |
Remember, while enabling all endpoints can be useful, it's essential always to weigh the benefits against potential security risks, ensuring proper authentication and authorization are in place. By doing so, you can harness the full power of Spring Boot Actuator alongside a robust security setup.
Related reading
- How to enable batch inserts with Hibernate and Spring Boot
- How to enable Bearer authentication on Spring Boot application?
- How to enable CORS in Spring Boot - Not working
- How to enable HTTP response caching in Spring Boot
- How to enable POST, PUT AND DELETE methods in spring security
- How to enable Scheduled jobs by profile in spring?
- How to encrypt String in Java
- How to ensure order of processing in Java 8 streams?

OOD Fundamentals
Master object-oriented design from first principles, SOLID, design patterns, and classic interview problems with hands-on coding.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.