Load LDIF file from classpath in unboundId mode

Fixes: gh-7833
This commit is contained in:
Eleftheria Stein
2020-01-20 14:44:02 +01:00
committed by Rob Winch
parent 57fba90c0e
commit 9740b5920b
3 changed files with 156 additions and 3 deletions

View File

@@ -114,10 +114,10 @@ public class UnboundIdContainer implements InitializingBean, DisposableBean, Lif
private void importLdif(InMemoryDirectoryServer directoryServer) {
if (StringUtils.hasText(this.ldif)) {
Resource resource = this.context.getResource(this.ldif);
try {
if (resource.exists()) {
try (InputStream inputStream = resource.getInputStream()) {
Resource[] resources = this.context.getResources(this.ldif);
if (resources.length > 0 && resources[0].exists()) {
try (InputStream inputStream = resources[0].getInputStream()) {
directoryServer.importFromLDIF(false, new LDIFReader(inputStream));
}
}