Use ResourceLoader.getClassLoader() for factories

Update `SpringApplication` to load and initialize `spring.factories`
classes using the `ResourceLoader.getClassLoader()`.

Closes gh-14641
This commit is contained in:
Phillip Webb 2018-10-04 13:56:56 -07:00
parent daa3d457b7
commit 6baaa3df77
1 changed files with 1 additions and 1 deletions

View File

@ -447,7 +447,7 @@ public class SpringApplication {
private <T> Collection<T> getSpringFactoriesInstances(Class<T> type,
Class<?>[] parameterTypes, Object... args) {
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
ClassLoader classLoader = getClassLoader();
// Use names and ensure unique to protect against duplicates
Set<String> names = new LinkedHashSet<>(
SpringFactoriesLoader.loadFactoryNames(type, classLoader));