0
# Spring Boot Admin Starter Client
1
2
Spring Boot Admin Starter Client is a Spring Boot starter that automatically configures a client application to register with a Spring Boot Admin server for centralized monitoring and management. It provides seamless integration with Spring Boot's actuator infrastructure and enables automatic discovery, registration, and health monitoring of applications in microservice architectures.
3
4
## Package Information
5
6
- **Package Name**: spring-boot-admin-starter-client
7
- **Package Type**: maven
8
- **Group ID**: de.codecentric
9
- **Language**: Java
10
- **Installation**: Add to your `pom.xml`:
11
12
```xml
13
<dependency>
14
<groupId>de.codecentric</groupId>
15
<artifactId>spring-boot-admin-starter-client</artifactId>
16
<version>3.4.1</version>
17
</dependency>
18
```
19
20
For Gradle:
21
22
```gradle
23
implementation 'de.codecentric:spring-boot-admin-starter-client:3.4.1'
24
```
25
26
## Core Imports
27
28
```java
29
// Auto-configuration classes (typically not imported directly)
30
import de.codecentric.boot.admin.client.config.SpringBootAdminClientAutoConfiguration;
31
import de.codecentric.boot.admin.client.config.ClientProperties;
32
import de.codecentric.boot.admin.client.config.InstanceProperties;
33
34
// Programmatic registration (advanced use cases)
35
import de.codecentric.boot.admin.client.registration.ApplicationRegistrator;
36
import de.codecentric.boot.admin.client.registration.Application;
37
```
38
39
## Basic Usage
40
41
The starter automatically configures the client when added to a Spring Boot application. Configuration is done through `application.properties` or `application.yml`:
42
43
```properties
44
# Basic configuration
45
spring.boot.admin.client.url=http://localhost:8080
46
spring.boot.admin.client.instance.name=my-service
47
48
# Optional: Authentication
49
spring.boot.admin.client.username=admin
50
spring.boot.admin.client.password=secret
51
52
# Optional: Custom metadata
53
spring.boot.admin.client.instance.metadata.environment=production
54
spring.boot.admin.client.instance.metadata.team=backend
55
```
56
57
YAML configuration:
58
59
```yaml
60
spring:
61
boot:
62
admin:
63
client:
64
url: http://localhost:8080
65
username: admin
66
password: secret
67
instance:
68
name: my-service
69
metadata:
70
environment: production
71
team: backend
72
```
73
74
## Architecture
75
76
The starter provides automatic configuration through Spring Boot's auto-configuration mechanism:
77
78
- **Auto-Configuration**: `SpringBootAdminClientAutoConfiguration` automatically creates necessary beans
79
- **Configuration Properties**: `ClientProperties` and `InstanceProperties` bind application properties
80
- **Registration Components**: Handle automatic registration and deregistration with the admin server
81
- **Metadata Contributors**: Collect and contribute application metadata
82
- **HTTP Client Support**: Works with both servlet (RestTemplate) and reactive (WebClient) stacks
83
84
## Capabilities
85
86
### Client Configuration
87
88
Configure connection settings, authentication, and registration behavior for the admin client.
89
90
```java { .api }
91
@ConfigurationProperties("spring.boot.admin.client")
92
public class ClientProperties {
93
public String[] getUrl();
94
public void setUrl(String[] url);
95
public Duration getPeriod();
96
public void setPeriod(Duration period);
97
public String getUsername();
98
public void setUsername(String username);
99
public String getPassword();
100
public void setPassword(String password);
101
public boolean isAutoRegistration();
102
public void setAutoRegistration(boolean autoRegistration);
103
public boolean isAutoDeregistration(Environment environment);
104
public void setAutoDeregistration(Boolean autoDeregistration);
105
public boolean isEnabled();
106
public void setEnabled(boolean enabled);
107
}
108
```
109
110
[Client Configuration](./client-configuration.md)
111
112
### Instance Configuration
113
114
Configure instance-specific properties like service URLs, metadata, and discovery settings.
115
116
```java { .api }
117
@ConfigurationProperties("spring.boot.admin.client.instance")
118
public class InstanceProperties {
119
public String getName();
120
public void setName(String name);
121
public String getServiceUrl();
122
public void setServiceUrl(String serviceUrl);
123
public String getManagementUrl();
124
public void setManagementUrl(String managementUrl);
125
public String getHealthUrl();
126
public void setHealthUrl(String healthUrl);
127
public Map<String, String> getMetadata();
128
public void setMetadata(Map<String, String> metadata);
129
public ServiceHostType getServiceHostType();
130
public void setServiceHostType(ServiceHostType serviceHostType);
131
}
132
```
133
134
[Instance Configuration](./instance-configuration.md)
135
136
### Application Registration
137
138
Programmatic control over application registration and deregistration with the admin server.
139
140
```java { .api }
141
public interface ApplicationRegistrator {
142
boolean register();
143
void deregister();
144
String getRegisteredId();
145
}
146
```
147
148
[Application Registration](./application-registration.md)
149
150
### Metadata Management
151
152
Extend application metadata through custom contributors and built-in metadata sources.
153
154
```java { .api }
155
@FunctionalInterface
156
public interface MetadataContributor {
157
Map<String, String> getMetadata();
158
}
159
```
160
161
[Metadata Management](./metadata-management.md)
162
163
### Cloud Platform Integration
164
165
Special configuration and auto-detection for Cloud Foundry and other cloud platforms.
166
167
```java { .api }
168
@ConfigurationProperties("spring.boot.admin.client.instance.metadata")
169
public class CloudFoundryApplicationProperties {
170
// Cloud Foundry specific properties
171
}
172
```
173
174
[Cloud Platform Integration](./cloud-platform-integration.md)
175
176
## Common Types
177
178
```java { .api }
179
public enum ServiceHostType {
180
IP, HOST_NAME, CANONICAL_HOST_NAME
181
}
182
183
public class Application {
184
public static Builder create(String name);
185
public String getName();
186
public String getManagementUrl();
187
public String getHealthUrl();
188
public String getServiceUrl();
189
public Map<String, String> getMetadata();
190
191
public static class Builder {
192
public Builder name(String name);
193
public Builder managementUrl(String managementUrl);
194
public Builder healthUrl(String healthUrl);
195
public Builder serviceUrl(String serviceUrl);
196
public Builder metadata(String key, String value);
197
public Application build();
198
}
199
}
200
```