Client Registration
To monitor your applications with Spring Boot Admin, they need to register with the Admin Server. There are three main approaches to achieve this:
- Spring Boot Admin Client - Direct registration
- Spring Cloud Discovery - Automatic registration via service discovery
- Static Configuration - Manual configuration on the server side
Using Spring Boot Admin Client
The Spring Boot Admin Client library enables applications to register themselves directly with the Admin Server.
Step 1: Add Dependencies
Add the Spring Boot Admin Client starter to your application:
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-client</artifactId>
<version>4.0.2</version>
</dependency>
For Gradle:
implementation 'de.codecentric:spring-boot-admin-starter-client:4.0.2'
Step 2: Configure the Admin Server URL
Add the Admin Server URL to your application.properties or application.yml:
spring:
boot:
admin:
client:
url: http://localhost:8080 # URL of your Admin Server
management:
endpoints:
web:
exposure:
include: "*" # Expose all actuator endpoints
endpoint:
health:
show-details: ALWAYS
info:
env:
enabled: true # Enable the info endpoint
spring.boot.admin.client.url=http://localhost:8080
management.endpoints.web.exposure.include=*
management.endpoint.health.show-details=ALWAYS
management.info.env.enabled=true
Step 3: Start Your Application
When your application starts, it will automatically register with the Admin Server. You'll see your application appear in the Admin Server's web interface.
Client Configuration Options
Custom Instance Metadata
Add custom metadata to your application registration:
spring:
boot:
admin:
client:
instance:
metadata:
tags:
environment: production
region: us-east-1
team: platform
Custom Service URL
Override the service URL that the Admin Server uses to connect:
spring:
boot:
admin:
client:
instance:
service-url: https://my-app.example.com
service-host-type: IP # or CANONICAL
Registration Interval
Configure how often the client registers with the server:
spring:
boot:
admin:
client:
period: 10000 # milliseconds (default: 10000)
auto-registration: true # Enable/disable auto-registration
Using Spring Cloud Discovery
If you're using Spring Cloud Discovery (Eureka, Consul, Zookeeper), you don't need the Spring Boot Admin Client. The Admin Server can discover applications automatically.
Eureka Example
Step 1: Add Eureka Client Dependency
Add to your application:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
Step 2: Configure Eureka
eureka:
client:
serviceUrl:
defaultZone: http://localhost:8761/eureka/
instance:
leaseRenewalIntervalInSeconds: 10
health-check-url-path: /actuator/health
metadata-map:
startup: ${random.int} # Trigger info update after restart
management:
endpoints:
web:
exposure:
include: "*"
endpoint:
health:
show-details: ALWAYS
Step 3: Enable Discovery on Admin Server
Add Eureka client to your Admin Server:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
Enable discovery in the Admin Server:
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
@EnableDiscoveryClient
@EnableAdminServer
@SpringBootApplication
public class SpringBootAdminApplication {
static void main(String[] args) {
SpringApplication.run(SpringBootAdminApplication.class, args);
}
}
Consul Example
spring:
cloud:
consul:
discovery:
metadata:
user-name: ${spring.security.user.name}
user-password: ${spring.security.user.password}
Consul does not allow dots (".") in metadata keys. Use dashes instead (e.g., user-name instead of user.name).
Zookeeper Example
For Zookeeper integration, see the spring-boot-admin-sample-zookeeper example.
Static Configuration
You can configure applications statically on the Admin Server using Spring Cloud's SimpleDiscoveryClient.
spring:
cloud:
discovery:
client:
simple:
instances:
my-application:
- uri: http://localhost:8081
metadata:
management.context-path: /actuator
This approach is useful for:
- Legacy applications that can't be modified
- Applications running in environments without service discovery
- Static infrastructure setups
Securing Client Registration
When your Admin Server is secured, clients need credentials to register:
spring:
boot:
admin:
client:
url: http://localhost:8080
username: admin
password: secret
For more details, see Security.
Exposing Actuator Endpoints
Spring Boot Admin requires access to actuator endpoints. Ensure they are properly exposed:
management:
endpoints:
web:
exposure:
include: "*" # Expose all endpoints
# Or be more specific:
# include: health,info,metrics,env,loggers
In production, carefully consider which endpoints to expose and implement proper security measures.
Verifying Registration
After configuring your client:
- Start your Admin Server
- Start your client application
- Navigate to the Admin Server UI (
http://localhost:8080) - Your application should appear in the applications list
Check the logs for registration confirmation:
INFO: Application registered itself as <instance-id>
Troubleshooting
Application Not Appearing
- Verify the Admin Server URL is correct
- Check network connectivity between client and server
- Ensure actuator endpoints are exposed
- Review client logs for registration errors
- Verify security credentials if server is secured
Registration Keeps Failing
- Check if the Admin Server is running
- Verify firewall rules allow communication
- Ensure the management port is accessible
- Check for proxy or network configuration issues
Next Steps
- Client Features - Learn about version display, JMX, logs, and tags
- Client Configuration - Explore advanced client configuration
- Service Discovery - Deep dive into Spring Cloud integration
Example Projects
- spring-boot-admin-sample-servlet - Direct client registration with security
- spring-boot-admin-sample-eureka - Eureka discovery example
- spring-boot-admin-sample-consul - Consul discovery example