diff --git a/module/spring-boot-restclient/src/main/java/org/springframework/boot/restclient/autoconfigure/PropertiesRestClientCustomizer.java b/module/spring-boot-restclient/src/main/java/org/springframework/boot/restclient/autoconfigure/PropertiesRestClientCustomizer.java index cf4224cdc93..db9dcf2d9fb 100644 --- a/module/spring-boot-restclient/src/main/java/org/springframework/boot/restclient/autoconfigure/PropertiesRestClientCustomizer.java +++ b/module/spring-boot-restclient/src/main/java/org/springframework/boot/restclient/autoconfigure/PropertiesRestClientCustomizer.java @@ -73,7 +73,10 @@ public class PropertiesRestClientCustomizer implements RestClientCustomizer { @SuppressWarnings("NullAway") // Lambda isn't detected with the correct nullability private void setDefaultApiVersion(Builder builder, PropertyMapper map, AbstractRestClientProperties properties) { - map.from(properties.getApiversion()).as(ApiversionProperties::getDefaultVersion).to(builder::defaultApiVersion); + map.from(properties.getApiversion()) + .as(ApiversionProperties::getDefaultVersion) + .whenNonNull() + .to(builder::defaultApiVersion); } private Consumer putAllHeaders(Map> defaultHeaders) {