Master Spring Boot Admin: Build, Configure, and Monitor Your Spring Boot Apps
This guide walks you through installing Spring Boot Admin, configuring a monitoring server, adding the client starter to a Spring Boot application, enabling Actuator for expanded metrics, and using SBA to view health, JVM, logs, and real‑time performance data across single or clustered services.
Spring Boot Admin (SBA) is an open‑source community project for managing and monitoring Spring Boot applications. Applications can register to SBA via HTTP or Spring Cloud service discovery, enabling visual management and inspection.
SBA can monitor single‑node or clustered Spring Boot projects, providing health, memory, JVM, GC, log, scheduled tasks, cache, and other details.
1. Set up the SBA server
Create a Spring Boot project for the admin server and add the following dependencies:
<code><dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-server</artifactId>
</dependency>
</code>1.1 Enable the SBA service
Add the
@EnableAdminServerannotation to the main class:
<code>import de.codecentric.boot.admin.server.config.EnableAdminServer;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@EnableAdminServer
@SpringBootApplication
public class SbaServerApplication {
public static void main(String[] args) {
SpringApplication.run(SbaServerApplication.class, args);
}
}
</code>1.2 Configure the server port
Set a dedicated port (e.g., 9001) in
application.properties:
<code>server.port=9001
</code>Configure a unique port to avoid conflicts with other Spring Boot projects.
After starting the server, the SBA homepage becomes available.
2. Create a regular Spring Boot application
Add the SBA client starter to the project's
pom.xml:
<code><dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-client</artifactId>
</dependency>
</code>Configure the client to point to the SBA server:
<code># Application port
server.port=8080
# SBA server address
spring.boot.admin.client.url=http://localhost:9001
</code>3. View the monitored application
After the client starts, the SBA UI lists the application, its health status, and provides an “Application Wall” with detailed pages.
4. Monitor application failures
When a monitored Spring Boot instance stops, SBA shows it as OFFLINE and records the timestamp in the event log.
5. Expand the monitored items
To expose more metrics, add the Actuator starter to the client and enable all endpoints:
<code><dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
</code> <code># Expose all actuator endpoints
management.endpoints.web.exposure.include=*
</code>After restarting, SBA displays additional information such as startup time, CPU usage, GC details, JVM thread dumps, log‑level configuration, performance metrics, environment properties, scheduled tasks, and cache management.
6. View real‑time logs
Configure a log file path in the client so that SBA can read and display logs:
<code># Log file location
logging.file.path=C:\\work\\log
</code>With the path set, SBA shows live logs and allows downloading them.
Conclusion
Spring Boot Admin provides comprehensive health, memory, JVM, GC, logging, scheduling, and cache monitoring for Spring Boot applications. By setting up an SBA server, adding the client starter and Actuator to each application, you can achieve full‑stack monitoring of your backend services.
macrozheng
Dedicated to Java tech sharing and dissecting top open-source projects. Topics include Spring Boot, Spring Cloud, Docker, Kubernetes and more. Author’s GitHub project “mall” has 50K+ stars.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.