Browse Source

Merge branch '3.3.x' into 3.4.x

Closes gh-44874
pull/44507/head
Stéphane Nicoll 10 months ago
parent
commit
7424ad59ee
  1. 10
      spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/ldap/embedded/EmbeddedLdapAutoConfiguration.java

10
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/ldap/embedded/EmbeddedLdapAutoConfiguration.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2023 the original author or authors. * Copyright 2012-2025 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -28,10 +28,10 @@ import com.unboundid.ldap.listener.InMemoryListenerConfig;
import com.unboundid.ldap.sdk.LDAPException; import com.unboundid.ldap.sdk.LDAPException;
import com.unboundid.ldap.sdk.schema.Schema; import com.unboundid.ldap.sdk.schema.Schema;
import com.unboundid.ldif.LDIFReader; import com.unboundid.ldif.LDIFReader;
import jakarta.annotation.PreDestroy;
import org.springframework.aot.hint.RuntimeHints; import org.springframework.aot.hint.RuntimeHints;
import org.springframework.aot.hint.RuntimeHintsRegistrar; import org.springframework.aot.hint.RuntimeHintsRegistrar;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionMessage; import org.springframework.boot.autoconfigure.condition.ConditionMessage;
@ -77,7 +77,7 @@ import org.springframework.util.StringUtils;
@ConditionalOnClass(InMemoryDirectoryServer.class) @ConditionalOnClass(InMemoryDirectoryServer.class)
@Conditional(EmbeddedLdapAutoConfiguration.EmbeddedLdapCondition.class) @Conditional(EmbeddedLdapAutoConfiguration.EmbeddedLdapCondition.class)
@ImportRuntimeHints(EmbeddedLdapAutoConfigurationRuntimeHints.class) @ImportRuntimeHints(EmbeddedLdapAutoConfigurationRuntimeHints.class)
public class EmbeddedLdapAutoConfiguration { public class EmbeddedLdapAutoConfiguration implements DisposableBean {
private static final String PROPERTY_SOURCE_NAME = "ldap.ports"; private static final String PROPERTY_SOURCE_NAME = "ldap.ports";
@ -167,8 +167,8 @@ public class EmbeddedLdapAutoConfiguration {
return (Map<String, Object>) propertySource.getSource(); return (Map<String, Object>) propertySource.getSource();
} }
@PreDestroy @Override
public void close() { public void destroy() throws Exception {
if (this.server != null) { if (this.server != null) {
this.server.shutDown(true); this.server.shutDown(true);
} }

Loading…
Cancel
Save