Start building against Spring LDAP 4.1.0-M1 snapshots

See gh-49119
This commit is contained in:
Andy Wilkinson
2026-02-10 09:24:12 +00:00
parent be750eb306
commit d26b6895ef
5 changed files with 12 additions and 15 deletions
@@ -244,9 +244,11 @@ public final class EmbeddedLdapAutoConfiguration implements DisposableBean {
EmbeddedLdapProperties embeddedProperties) {
LdapContextSource source = new LdapContextSource();
source.setBase(properties.getBase());
if (embeddedProperties.getCredential().isAvailable()) {
source.setUserDn(embeddedProperties.getCredential().getUsername());
source.setPassword(embeddedProperties.getCredential().getPassword());
String username = embeddedProperties.getCredential().getUsername();
String password = embeddedProperties.getCredential().getPassword();
if (StringUtils.hasText(username) && StringUtils.hasText(password)) {
source.setUserDn(username);
source.setPassword(password);
}
source.setUrls(properties.determineUrls(environment));
return source;
@@ -24,7 +24,6 @@ import org.jspecify.annotations.Nullable;
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.
@@ -135,10 +134,6 @@ public class EmbeddedLdapProperties {
this.password = password;
}
boolean isAvailable() {
return StringUtils.hasText(this.username) && StringUtils.hasText(this.password);
}
}
public static class Ssl {
@@ -37,7 +37,7 @@ import org.springframework.util.Assert;
*/
public class LdapHealthIndicator extends AbstractHealthIndicator {
private static final ContextExecutor<String> versionContextExecutor = new VersionContextExecutor();
private static final ContextExecutor<@Nullable String> versionContextExecutor = new VersionContextExecutor();
private final LdapOperations ldapOperations;
@@ -50,10 +50,12 @@ public class LdapHealthIndicator extends AbstractHealthIndicator {
@Override
protected void doHealthCheck(Health.Builder builder) throws Exception {
String version = this.ldapOperations.executeReadOnly(versionContextExecutor);
builder.up().withDetail("version", version);
if (version != null) {
builder.up().withDetail("version", version);
}
}
private static final class VersionContextExecutor implements ContextExecutor<String> {
private static final class VersionContextExecutor implements ContextExecutor<@Nullable String> {
@Override
public @Nullable String executeWithContext(DirContext ctx) throws NamingException {
@@ -272,9 +272,7 @@ class LdapAutoConfigurationTests {
@Bean
@Primary
PooledContextSource pooledContextSource(LdapContextSource ldapContextSource) {
PooledContextSource pooledContextSource = new PooledContextSource(new PoolConfig());
pooledContextSource.setContextSource(ldapContextSource);
return pooledContextSource;
return new PooledContextSource(ldapContextSource, new PoolConfig());
}
}
@@ -2549,7 +2549,7 @@ bom {
releaseNotes("https://github.com/spring-projects/spring-kafka/releases/tag/v{version}")
}
}
library("Spring LDAP", "4.0.1") {
library("Spring LDAP", "4.1.0-SNAPSHOT") {
considerSnapshots()
group("org.springframework.ldap") {
modules = [