spring-boot-admin-docs/src/site/docs/11-upgrading/01-spring-boot-admin-4.md
This guide covers the breaking changes, deprecated features, and migration steps required to upgrade from Spring Boot Admin 3.x to 4.x.
Before upgrading to Spring Boot Admin 4, ensure your application meets these requirements:
:::tip Java Version Compatibility Spring Boot Admin strives to support the same Java baseline version as the corresponding Spring Boot version. This means:
Always check the Spring Boot documentation for the supported Java versions of your Spring Boot version. :::
What Changed:
Spring Boot Admin 4 replaces Spring's nullable annotations with JSpecify annotations for better null-safety across the Java ecosystem.
Migration:
// Before (Spring Boot Admin 3.x)
import org.springframework.lang.Nullable;
public class MyService {
public void process(@Nullable String value) {
// ...
}
}
// After (Spring Boot Admin 4.x)
import org.jspecify.annotations.Nullable;
public class MyService {
public void process(@Nullable String value) {
// ...
}
}
Action Required:
If you extend Spring Boot Admin classes or implement interfaces using @Nullable annotations:
pom.xml:<dependency>
<groupId>org.jspecify</groupId>
<artifactId>jspecify</artifactId>
<version>1.0.0</version>
</dependency>
org.springframework.lang.Nullable to org.jspecify.annotations.NullableWhat Changed:
Spring Boot Admin 4 modernizes HTTP client usage:
RestClient exclusively (replaces WebClient autoconfiguration)WebClient for instance communication and RestTemplate for notifiersMigration:
The client autoconfiguration now provides RestClient instead of WebClient:
// Before (Spring Boot Admin 3.x)
@Bean
public WebClient.Builder webClientBuilder() {
return WebClient.builder()
.defaultHeader("X-Custom-Header", "value");
}
// After (Spring Boot Admin 4.x)
@Bean
public RestClient.Builder restClientBuilder() {
return RestClient.builder()
.defaultHeader("X-Custom-Header", "value");
}
No changes required - the server continues using WebClient for instance communication:
// Server-side customization (unchanged)
@Bean
public InstanceWebClient instanceWebClient(WebClient.Builder builder) {
return InstanceWebClient.builder(builder)
.connectTimeout(Duration.ofSeconds(5))
.build();
}
Action Required:
WebClient.Builder to RestClient.BuilderWebClient in client applicationsprefer-ip RemovedWhat Changed:
The property spring.boot.admin.client.instance.prefer-ip has been removed in favor of the more flexible
spring.boot.admin.client.instance.service-host-type.
Migration:
# Before (Spring Boot Admin 3.x)
spring:
boot:
admin:
client:
instance:
prefer-ip: true
# After (Spring Boot Admin 4.x)
spring:
boot:
admin:
client:
instance:
service-host-type: IP # Options: IP, HOST_NAME, CANONICAL_HOST_NAME
Available Options:
| Value | Description |
|---|---|
IP | Use IP address (equivalent to old prefer-ip: true) |
HOST_NAME | Use hostname (equivalent to old prefer-ip: false) |
CANONICAL_HOST_NAME | Use canonical hostname |
Action Required:
prefer-ipservice-host-type: IP (if prefer-ip: true) or service-host-type: HOST_NAME (if prefer-ip: false)What Changed:
Spring Boot Admin 4 manages the Jolokia Spring Boot integration org.jolokia:jolokia-support-springboot 2.5.x, which supports Spring Boot 4.
Action Required:
jolokia-support-springboot
for Spring Boot 4+ clients and jolokia-support-springboot3 for Spring Boot 3.x clients). For Spring Boot 2.x
applications managed by Spring Boot Admin 2 or 3, use jolokia-core as described in the corresponding SBA
version documentation. See the JMX-Bean Management
section for the exact dependency coordinates per Spring Boot version.Follow these steps to ensure a smooth upgrade:
Update your pom.xml:
<properties>
<spring-boot.version>4.0.0</spring-boot.version>
<spring-boot-admin.version>4.0.0</spring-boot-admin.version>
</properties>
<dependencies>
<!-- Admin Server -->
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-server</artifactId>
<version>${spring-boot-admin.version}</version>
</dependency>
<!-- Admin Client -->
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-client</artifactId>
<version>${spring-boot-admin.version}</version>
</dependency>
</dependencies>
prefer-ip property:# Find and replace in all configuration files
grep -r "prefer-ip" src/main/resources/
# Replace with service-host-type
# Check for WebClient customizations in client apps
grep -r "WebClient.Builder" src/main/java/
# Find all Spring nullable imports
find src -name "*.java" -exec grep -l "org.springframework.lang.Nullable" {} \;
# Replace with JSpecify
sed -i 's/org.springframework.lang.Nullable/org.jspecify.annotations.Nullable/g' <files>
Review and update any beans creating WebClient.Builder for the Admin Client.
mvn spring-boot:run
Watch for deprecation warnings or errors:
tail -f logs/spring-boot-admin.log | grep -i "deprecat\|error\|warn"
If you encounter issues during the upgrade:
spring-boot-adminKey Changes:
org.springframework.lang.Nullable with org.jspecify.annotations.NullableWebClient to RestClientprefer-ip to service-host-typeMost applications can upgrade with minimal code changes, primarily focused on configuration updates and dependency management.