diff --git a/module/spring-boot-ldap/src/main/java/org/springframework/boot/ldap/autoconfigure/embedded/EmbeddedLdapProperties.java b/module/spring-boot-ldap/src/main/java/org/springframework/boot/ldap/autoconfigure/embedded/EmbeddedLdapProperties.java index f3a7303ee08a..c361ed7592d0 100644 --- a/module/spring-boot-ldap/src/main/java/org/springframework/boot/ldap/autoconfigure/embedded/EmbeddedLdapProperties.java +++ b/module/spring-boot-ldap/src/main/java/org/springframework/boot/ldap/autoconfigure/embedded/EmbeddedLdapProperties.java @@ -24,6 +24,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.convert.Delimiter; import org.springframework.core.io.Resource; +import org.springframework.util.StringUtils; /** * Configuration properties for Embedded LDAP. @@ -150,7 +151,7 @@ public static class Ssl { private @Nullable String bundle; public boolean isEnabled() { - return (this.enabled != null) ? this.enabled : this.bundle != null; + return (this.enabled != null) ? this.enabled : StringUtils.hasText(this.bundle); } public void setEnabled(boolean enabled) { diff --git a/module/spring-boot-ldap/src/test/java/org/springframework/boot/ldap/autoconfigure/embedded/EmbeddedLdapAutoConfigurationTests.java b/module/spring-boot-ldap/src/test/java/org/springframework/boot/ldap/autoconfigure/embedded/EmbeddedLdapAutoConfigurationTests.java index 9830effb7abc..f25a153d33b9 100644 --- a/module/spring-boot-ldap/src/test/java/org/springframework/boot/ldap/autoconfigure/embedded/EmbeddedLdapAutoConfigurationTests.java +++ b/module/spring-boot-ldap/src/test/java/org/springframework/boot/ldap/autoconfigure/embedded/EmbeddedLdapAutoConfigurationTests.java @@ -411,6 +411,13 @@ void whenInvalidSslBundleIsConfiguredThenStartFails() { }); } + @Test + void sslIsNotEnabledWhenBundleIsEmpty() { + EmbeddedLdapProperties properties = new EmbeddedLdapProperties(); + properties.getSsl().setBundle(""); + assertThat(properties.getSsl().isEnabled()).isFalse(); + } + @Configuration(proxyBeanMethods = false) static class LdapClientConfiguration {