As your application grows into a distributed system (microservices), it becomes essential to monitor the health, performance, and status of each service. Spring Boot Admin makes this easy.
✅ What is Spring Boot Admin?
Spring Boot Admin is an open-source community project to manage and monitor Spring Boot applications via a web dashboard.
It provides:
- Health status (UP, DOWN)
- JVM metrics (memory, threads)
- Environment & configuration
- HTTP traces
- Loggers and levels
- Live logging configuration
🧱 Architecture Overview
- Spring Boot Admin Server: A web UI to monitor services.
- Spring Boot Admin Client: Each monitored app includes the client dependency to register itself with the server.
🛠️ 1. Setup Spring Boot Admin Server
🔹 Add Dependencies (admin-server pom.xml
)
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-server</artifactId>
<version>3.2.3</version> <!-- Match your Spring Boot version -->
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
🔹 Enable Admin Server
@SpringBootApplication
@EnableAdminServer
public class AdminServerApp {
public static void main(String[] args) {
SpringApplication.run(AdminServerApp.class, args);
}
}
🔹 Configuration (application.yml)
server:
port: 9090
spring:
application:
name: admin-server
management:
endpoints:
web:
exposure:
include: '*'
🧩 2. Setup Client (Monitored Service)
🔹 Add Dependencies (client pom.xml
)
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-client</artifactId>
<version>3.2.3</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
🔹 Configuration (application.yml)
spring:
application:
name: my-service
boot:
admin:
client:
url: http://localhost:9090 # Admin server URL
management:
endpoints:
web:
exposure:
include: '*'
endpoint:
health:
show-details: always
💻 3. Run and Monitor
- Start the Admin Server (
localhost:9090
) - Start one or more clients (services with actuator + admin-client)
- You’ll see them automatically appear in the dashboard 🖥️
🔎 Features in Admin Dashboard
Feature | Description |
---|---|
Health | Shows health status of services |
Metrics | JVM metrics, CPU, memory, threads |
Environment | View all environment variables |
Beans | List of all beans loaded by Spring |
Loggers | Change log levels dynamically |
Threads | Thread dumps |
HTTP Trace | Last few HTTP requests and responses |
🔐 4. Securing the Admin Server
spring:
security:
user:
name: admin
password: secret
On the client side:
spring:
boot:
admin:
client:
username: admin
password: secret
🧪 Testing Tips
- Simulate service failure → Admin shows
DOWN
- Change log level from the UI (DEBUG, INFO, ERROR)
🧰 Optional: Add Notifications (Slack, Email, Teams)
Spring Boot Admin supports notifications when a service goes down or changes state.
Add this config:
spring.boot.admin.notify.slack.enabled: true
spring.boot.admin.notify.slack.webhook-url: https://hooks.slack.com/services/...
🧵 Spring Boot Admin vs Actuator UI
Feature | Actuator JSON API | Spring Boot Admin UI |
---|---|---|
UI | ❌ | ✅ |
Multiservice support | ❌ | ✅ |
Dynamic log levels | ❌ | ✅ |
Thread dumps | Partial | ✅ |
Notification Support | ❌ | ✅ |
📦 Summary
Spring Boot Admin provides a central monitoring dashboard with little effort. Ideal for microservices and production monitoring. Combine it with:
- Prometheus/Grafana → Metrics
- ELK/EFK Stack → Logs
- Zipkin/Jaeger → Tracing
➡️ Next Up: Part 18 – Distributed Tracing with Sleuth and Zipkin