Fixed ClassLoader discovery logic in BinderFactoryConfiguration

This commit is contained in:
Oleg Zhurakousky
2017-11-27 21:57:00 -05:00
parent f53ff9585a
commit 593b8c38ca

View File

@@ -146,9 +146,7 @@ public class BinderFactoryConfiguration {
public BinderTypeRegistry binderTypeRegistry(ConfigurableApplicationContext configurableApplicationContext) {
Map<String, BinderType> binderTypes = new HashMap<>();
ClassLoader classLoader = configurableApplicationContext.getClassLoader();
if (classLoader == null) {
classLoader = BinderFactoryConfiguration.class.getClassLoader();
}
// the above can never be null since it will default to ClassUtils.getDefaultClassLoader(..)
try {
Enumeration<URL> resources = classLoader.getResources("META-INF/spring.binders");
if (!Boolean.valueOf(this.selfContained) && (resources == null || !resources.hasMoreElements())) {