DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Because the DevOps movement has redefined engineering responsibilities, SREs now have to become stewards of observability strategy.

Apache Cassandra combines the benefits of major NoSQL databases to support data management needs not covered by traditional RDBMS vendors.

The software you build is only as secure as the code that powers it. Learn how malicious code creeps into your software supply chain.

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

Related

  • Structured Logging in Spring Boot 3.4 for Improved Logs
  • Querydsl vs. JPA Criteria, Part 6: Upgrade Guide To Spring Boot 3.2 for Spring Data JPA and Querydsl Project
  • Upgrade Guide To Spring Boot 3.0 for Spring Data JPA and Querydsl
  • How To Validate HTTP Post Request Body - Restful Web Services With Spring Framework | Spring Boot

Trending

  • Securing the Future: Best Practices for Privacy and Data Governance in LLMOps
  • Useful System Table Queries in Relational Databases
  • System Coexistence: Bridging Legacy and Modern Architecture
  • Simpler Data Transfer Objects With Java Records
  1. DZone
  2. Coding
  3. Frameworks
  4. Actuator Enhancements: Spring Framework 6.2 and Spring Boot 3.4

Actuator Enhancements: Spring Framework 6.2 and Spring Boot 3.4

A comparison of the traditional implementation of the actuator and its enhancements in the latest spring framework 6.2 and Spring Boot 3.4, along with its usage.

By 
Karthik Kamarapu user avatar
Karthik Kamarapu
·
Mar. 05, 25 · Analysis
Likes (5)
Comment
Save
Tweet
Share
3.8K Views

Join the DZone community and get the full member experience.

Join For Free

In Spring Boot, an Actuator is a framework module that provides features for managing and monitoring applications. It helps developers and operations teams to gain insights into the run-time behavior of their applications and provides capabilities for health checking, metrics collection, and application management via a set of built-in and customizable endpoints.

Traditional Implementation of Actuators

  1. Monitor health of the applications using endpoints like /actuator/health. 
  2. Provide application metrics such as memory usage and thread count using /actuator/metrics.
  3. Endpoints like /info, /env, and /beans expose state of the application.
  4. Developers had to integrate monitoring tools manually.

Example of traditional use:

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


Accessing the health endpoint:

Shell
 
curl http://localhost:8080/actuator/health


Output:

JSON
 
{
  "status": "UP"
}


Actuator Enhancements in Spring Framework 6.2 and Spring Boot 3.4

The latest updates to Spring Boot Actuator in Spring Boot 3.4 provide updated features and extended capabilities to monitor, manage, and troubleshoot Spring-based applications. 

1.  Expanded Endpoint Functionality

Additional endpoints are introduced to provide deeper insights into the health of the application and its runtime behavior.

  • /actuator/startup – Displays application startup metrics and the detailed information about the initialization process.
  • /actuator/env/{name} – This allows querying specific environment properties.
  • /actuator/containers – When running in a Docker or Kubernetes environment, this endpoint monitors container-specific metrics. 

Example: 

Properties files
 
management.endpoints.web.exposure.include=health,info,startup,env,containers


Accessing the /actuator/startup endpoint:

Shell
 
curl http://localhost:8000/actuator/startup


Output: 

JSON
 
{
  "timeline": {
    "events": [
      { "phase": "starting", "duration": 100 },
      { "phase": "environment prepared", "duration": 200 },
      { "phase": "context refreshed", "duration": 800 }
    ],
    "totalTime": 1100
  }
}


2. Structured Logging Support

The actuator now integrates with a structured logging framework to output the logs in machine-readable formats like JSON, which makes it easier to process logs in centralized logging systems.

Example of log integration for startup:

JSON
 
{
  "timestamp": "2025-01-18T12:34:56.789Z",
  "level": "INFO",
  "message": "Application started",
  "logger": "org.springframework.boot.actuate.endpoint.StartupEndpoint",
  "data": {
    "beansInitialized": 350,
    "startupTime": "1200ms"
  }
}


3. Improved Metrics and Observability

Integration with Prometheus and other metrics systems is updated to provide more granular application insights.

Example of adding dependencies for metrics and tracing:

XML
 
<dependency>
  <groupId>io.micrometer</groupId>
  <artifactId>micrometer-registry-prometheus</artifactId>
</dependency>
<dependency>
  <groupId>io.opentelemetry</groupId>
  <artifactId>opentelemetry-sdk</artifactId>
</dependency>


Exposing the Prometheus metrics:

Properties files
 
management.metrics.export.prometheus.enabled=true management.endpoints.web.exposure.include=prometheus


Accessing the Prometheus metrics:

Shell
 
curl http://localhost:8080/actuator/prometheus


Output (truncated):

JSON
 
# HELP jvm_memory_used_bytes The amount of used memory
jvm_memory_used_bytes{area="heap"} 12345678
jvm_memory_used_bytes{area="nonheap"} 9876543


4. Kubernetes Probes Integration

This ensures better orchestration and reliability of the application.

Example of a Kubernetes configuration:

YAML
 
livenessProbe:
  httpGet:
    path: /actuator/health/liveness
    port: 8080
  initialDelaySeconds: 3
  periodSeconds: 10
readinessProbe:
  httpGet:
    path: /actuator/health/readiness
    port: 8080
  initialDelaySeconds: 3
  periodSeconds: 10


Accessing readiness probe:

Shell
 
curl http://localhost:8080/actuator/health/readiness


Output:

JSON
 
{
  "status": "UP",
  "components": {
    "database": { "status": "UP" },
    "diskSpace": { "status": "UP" }
  }
}


5. Customizable Health Indicators

Developers can now define more granular health checks for specific components and services.

Example of a custom health indicator:

Java
 
@Component
public class CustomHealthIndicator implements HealthIndicator {
    @Override
    public Health health() {
        boolean healthy = checkExternalService();
        return healthy ? Health.up().build() : Health.down().withDetail("Error", "Service unavailable").build();
    }

    private boolean checkExternalService() {
        // Logic to check the status of an external service
        return true;
    }
}


Accessing the health endpoint: 

Shell
 
curl http://localhost:8080/actuator/health


Output:

JSON
 
{
  "status": "UP",
  "components": {
    "customHealthIndicator": {
      "status": "UP"
    }
  }
}


6. Simplified Configuration For Cloud Environments

Enhanced support is now provided for managing Actuator configurations in cloud-native environments, including dynamically enabling or disabling the endpoints and integration of ConfigMaps and Secrets in Kubernetes.

Example of dynamic configuration:

YAML
 
apiVersion: v1
kind: ConfigMap
metadata:
  name: actuator-config
  namespace: default
  labels:
    app: spring-boot
  annotations:
    description: "Dynamic configuration for Spring Boot Actuator"
data:
  management.endpoints.web.exposure.include: "health,info,metrics"


Reloading the configuration and access metrics:

Properties files
 
curl http://localhost:8080/actuator/metrics


Output:

JSON
 
{
  "names": [
    "jvm.memory.used",
    "http.server.requests"
  ]
}


Conclusion

The enhancements added in Spring Framework 6.2 and Spring Boot 3.4 significantly help in building observable and cloud-native applications that help developers and teams manage applications efficiently in production environments.

Spring Framework Framework Spring Boot

Opinions expressed by DZone contributors are their own.

Related

  • Structured Logging in Spring Boot 3.4 for Improved Logs
  • Querydsl vs. JPA Criteria, Part 6: Upgrade Guide To Spring Boot 3.2 for Spring Data JPA and Querydsl Project
  • Upgrade Guide To Spring Boot 3.0 for Spring Data JPA and Querydsl
  • How To Validate HTTP Post Request Body - Restful Web Services With Spring Framework | Spring Boot

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!