Spring Boot Resources

Spring Boot - Admin Client



For monitoring and managing your microservice application via Spring Boot Admin Server, you should add the Spring Boot Admin starter client dependency and point out the Admin Server URI into the application properties file.

Note − For monitoring an application, you should enable the Spring Boot Actuator Endpoints for your Microservice application.

For building a Spring Boot Admin Server we need to add the below dependencies in your build configuration file.

Maven users can add the below dependencies in your pom.xml file −

<dependency>
   <groupId>de.codecentric</groupId>
   <artifactId>spring-boot-admin-starter-client</artifactId>
</dependency>
<dependency>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

Gradle users can add the below dependencies in your build.gradle file −

compile group: 'de.codecentric', name: 'spring-boot-admin-starter-client', version: '3.3.3'
compile('org.springframework.boot:spring-boot-starter-actuator')

Now, add the Spring Boot Admin Server URL into your application properties file.

For properties file users, add the following properties in the application.properties file.

spring.boot.admin.url = http://localhost:9090/

For YAML users, add the following property in application.yml file.

spring:
   boot:
      admin:
         url: http://localhost:9000/

Example - Creating Spring Admin Client

First, download the Spring Boot project from the Spring Initializer page and choose the Spring Admin Client and Spring Boot Actuator. Observe the screenshot given below −

Creating Spring Admin Client

Following is Spring Boot main class.

AdminclientApplication.java

package com.tutorialspoint.adminclient;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class AdminclientApplication {
   public static void main(String[] args) {
      SpringApplication.run(AdminclientApplication.class, args);
   }
}

Now, define the admin server url in application.properties file a shown −

spring.boot.admin.client.url=http://localhost:9090
management.endpoints.web.exposure.include=*
management.info.env.enabled=true

For YAML users, use the following properties to define the port number and application name in application.yml file.

spring:
   application:
      name: adminserver
   boot:
      admin:
         client:
             url: http://localhost:9090/	  

The build configuration file is given below.

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <parent>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-parent</artifactId>
      <version>3.5.6</version>
      <relativePath/> <!-- lookup parent from repository -->
   </parent>
   <groupId>com.tutorialspoint</groupId>
   <artifactId>adminclient</artifactId>
   <version>0.0.1-SNAPSHOT</version>
   <name>adminserver</name>
   <description>Demo project for Spring Boot</description>
   <url/>
   <licenses>
      <license/>
   </licenses>
   <developers>
      <developer/>
   </developers>
   <scm>
      <connection/>
      <developerConnection/>
      <tag/>
      <url/>
   </scm>
   <properties>
      <java.version>21</java.version>
      <spring-boot-admin.version>3.5.0</spring-boot-admin.version>
   </properties>
   <dependencies>
      <dependency>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-actuator</artifactId>
      </dependency>
      <dependency>
         <groupId>de.codecentric</groupId>
         <artifactId>spring-boot-admin-starter-client</artifactId>
      </dependency>
      <dependency>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-test</artifactId>
         <scope>test</scope>
      </dependency>
   </dependencies>
   <dependencyManagement>
      <dependencies>
         <dependency>
            <groupId>de.codecentric</groupId>
            <artifactId>spring-boot-admin-dependencies</artifactId>
            <version>${spring-boot-admin.version}</version>
            <type>pom</type>
            <scope>import</scope>
         </dependency>
      </dependencies>
   </dependencyManagement>
   <build>
      <plugins>
         <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
         </plugin>
      </plugins>
   </build>
</project>

For Gradle users build.gradle file

buildscript {
   ext {
      springBootVersion = '3.5.0'
   }
   repositories {
      mavenCentral()
   }
   dependencies {
      classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
   }
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'

group = 'com.tutorialspoint'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 21
repositories {   
   mavenCentral()
}
dependencies {
   compile('org.springframework.boot:spring-boot-starter')
   compile('org.springframework.boot:spring-boot-starter-actuator')
   compile group: 'de.codecentric', name: 'spring-boot-admin-client', version: '3.5.0'
   testCompile('org.springframework.boot:spring-boot-starter-test')
}

Output

You can create an executable JAR file, and run the Spring Boot application by using the following Maven or Gradle commands −

For Maven, use the command shown here −

mvn clean install

After "BUILD SUCCESS", you can find the JAR file under target directory.

For Gradle, use the command shown here −

gradle clean build

After "BUILD SUCCESSFUL", you can find the JAR file under build/libs directory.

Now, run the JAR file by using the command given below −

java jar <JARFILE> 

Now, the application has started on the Tomcat port 9090 as shown here −

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/

 :: Spring Boot ::                (v3.5.6)

2025-09-29T16:54:57.381+05:30  INFO 16572 --- [           main] c.e.adminclient.AdminclientApplication   : Starting AdminclientApplication using Java 21.0.6 with PID 16572 (D:\Projects\adminclient\target\classes started by mahes in D:\Projects\adminclient)
2025-09-29T16:54:57.386+05:30  INFO 16572 --- [           main] c.e.adminclient.AdminclientApplication   : No active profile set, falling back to 1 default profile: "default"
2025-09-29T16:54:59.411+05:30  INFO 16572 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port 8080 (http)
2025-09-29T16:54:59.432+05:30  INFO 16572 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2025-09-29T16:54:59.432+05:30  INFO 16572 --- [           main] o.apache.catalina.core.StandardEngine    : Starting Servlet engine: [Apache Tomcat/10.1.46]
2025-09-29T16:54:59.497+05:30  INFO 16572 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2025-09-29T16:54:59.500+05:30  INFO 16572 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 2036 ms
2025-09-29T16:55:01.102+05:30  INFO 16572 --- [           main] o.s.b.a.e.web.EndpointLinksResolver      : Exposing 13 endpoints beneath base path '/actuator'
2025-09-29T16:55:01.365+05:30  INFO 16572 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port 8080 (http) with context path '/'
2025-09-29T16:55:01.382+05:30  INFO 16572 --- [           main] c.e.adminclient.AdminclientApplication   : Started AdminclientApplication in 4.653 seconds (process running for 5.131)
2025-09-29T16:55:02.001+05:30  INFO 16572 --- [gistrationTask1] d.c.b.a.c.r.ApplicationRegistrator       : Application registered itself as 50ed04178953
2025-09-29T16:55:02.030+05:30  INFO 16572 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring DispatcherServlet 'dispatcherServlet'
2025-09-29T16:55:02.030+05:30  INFO 16572 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
2025-09-29T16:55:02.032+05:30  INFO 16572 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Completed initialization in 2 ms

Now hit the following URL from your web browser and see your spring Boot application is registered with Spring Boot Admin Server.

http://localhost:9090/

Web Browser Admin Server

Now, click the Details button and the see the actuator endpoints in Admin Server UI.

Actuator Endpoints in Admin Server UI
Advertisements