|
1 | 1 | /*
|
2 |
| - * Copyright 2012-2023 the original author or authors. |
| 2 | + * Copyright 2012-2025 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
|
28 | 28 | import com.unboundid.ldap.sdk.LDAPException;
|
29 | 29 | import com.unboundid.ldap.sdk.schema.Schema;
|
30 | 30 | import com.unboundid.ldif.LDIFReader;
|
31 |
| -import jakarta.annotation.PreDestroy; |
32 | 31 |
|
33 | 32 | import org.springframework.aot.hint.RuntimeHints;
|
34 | 33 | import org.springframework.aot.hint.RuntimeHintsRegistrar;
|
| 34 | +import org.springframework.beans.factory.DisposableBean; |
35 | 35 | import org.springframework.boot.autoconfigure.AutoConfiguration;
|
36 | 36 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
37 | 37 | import org.springframework.boot.autoconfigure.condition.ConditionMessage;
|
|
77 | 77 | @ConditionalOnClass(InMemoryDirectoryServer.class)
|
78 | 78 | @Conditional(EmbeddedLdapAutoConfiguration.EmbeddedLdapCondition.class)
|
79 | 79 | @ImportRuntimeHints(EmbeddedLdapAutoConfigurationRuntimeHints.class)
|
80 |
| -public class EmbeddedLdapAutoConfiguration { |
| 80 | +public class EmbeddedLdapAutoConfiguration implements DisposableBean { |
81 | 81 |
|
82 | 82 | private static final String PROPERTY_SOURCE_NAME = "ldap.ports";
|
83 | 83 |
|
@@ -167,8 +167,8 @@ private Map<String, Object> getLdapPorts(MutablePropertySources sources) {
|
167 | 167 | return (Map<String, Object>) propertySource.getSource();
|
168 | 168 | }
|
169 | 169 |
|
170 |
| - @PreDestroy |
171 |
| - public void close() { |
| 170 | + @Override |
| 171 | + public void destroy() throws Exception { |
172 | 172 | if (this.server != null) {
|
173 | 173 | this.server.shutDown(true);
|
174 | 174 | }
|
|
0 commit comments