Java. Spring Boot Admin Service.

Sergei Golitsyn
GitStacks

--

Quite often, when using Spring applications, we use the Spring Boot Actuator. I do not really like this because it is not convenient for the user. You need to keep the necessary data in your head, remember the necessary endpoints. Spring Boot Admin comes to our rescue. As it turned out, not everyone knows about this impressive library. Let us figure out what it is and how to run it.
Spring Boot Admin is a web application used to manage and monitor Spring Boot applications. Each application can register as a client. Behind the scenes, the magic is created by the Spring Boot Actuator endpoints, which is, in fact, a beautiful add-on to Actuator.
Let us try to create our first Spring Boot Admin application and register clients with it.
In previous articles, we have already written a Java application and client. (Link to article) Let us try to register them as clients in the new Admin app. Let us create a new spring boot admin module and add the required dependency to it:

<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-server</artifactId>
<version>2.4.3</version>
</dependency>

To include the server in the main class, you need to add the @EnableAdminServer annotation, which, obviously by its name, will make our admin server available. Now we can add a client dependency to the modules we want to monitor:

<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-client</artifactId>
<version>2.4.3</version>
</dependency>

Further, in the properties of the module/project, you need to specify the path where the Admin Server is located. Add it to your application.yaml:

spring:
boot:
admin:
client:
url: http://localhost:8080

It is also worth adding the inclusion of extended endpoints in the actuator because, by default, only health and info are reflected:

management:
endpoints:
web:
exposure:
include: '*'
health:
show-details: always

After adding all of this to our project, we can start Spring Boot Admin and our server application. For a server using gRPC, there is one feature, if we want to receive information, then we need to wrap the gRPC application in a regular Web application. And only after that will we be able to register with Spring Boot Admin.

Now, if you follow the link http://127.0.0.1:8080/wallboard, then we will go to the admin application. There you can see several tabs. Application Tab — Shows all registered applications. The Journal will display various system events, such as when an application has written or changed its status.
Let’s go to the Application tab and select our application. The appearance will be something like this:

Application Tab

One of the more excellent options for me is changing the doping level of the application without restarting it. To do this, go to Loggers and select the blogger we want to change.

In the JVM tab, you can get Heap and Thread Dump. It is possible to download Thread Dump.

The Mappings tab will display all endpoints registered in the dispatcher servlet. And the Caches tab will display the application cache.

Spring Boot Admin is a convenient library for keeping track of the current state of the system. With a pretty friendly interface. Are you using Spring Boot Admin in your microservices?

--

--

7+ years of experience in building massively scalable systems (mostly using Java) both from scratch and diving into an existing codebase.