SpringFactoriesLoader tolerates whitespace around class names

Issue: SPR-17413
This commit is contained in:
Juergen Hoeller
2018-10-22 15:13:58 +02:00
parent 83a54dba7e
commit dd2ce20687
3 changed files with 11 additions and 12 deletions

View File

@@ -19,7 +19,6 @@ package org.springframework.core.io.support;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Enumeration;
import java.util.List;
@@ -139,9 +138,10 @@ public final class SpringFactoriesLoader {
UrlResource resource = new UrlResource(url);
Properties properties = PropertiesLoaderUtils.loadProperties(resource);
for (Map.Entry<?, ?> entry : properties.entrySet()) {
List<String> factoryClassNames = Arrays.asList(
StringUtils.commaDelimitedListToStringArray((String) entry.getValue()));
result.addAll((String) entry.getKey(), factoryClassNames);
String factoryClassName = ((String) entry.getKey()).trim();
for (String factoryName : StringUtils.commaDelimitedListToStringArray((String) entry.getValue())) {
result.add(factoryClassName, factoryName.trim());
}
}
}
cache.put(classLoader, result);