Merge branch '3.3.x' into 3.4.x

Closes gh-46018
This commit is contained in:
Andy Wilkinson 2025-06-18 17:37:52 +01:00
commit 7560e38adf
1 changed files with 6 additions and 7 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2025 the original author or authors. * Copyright 2012-2024 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -463,7 +463,7 @@ public class SpringApplication {
} }
private <T> List<T> getSpringFactoriesInstances(Class<T> type, ArgumentResolver argumentResolver) { private <T> List<T> getSpringFactoriesInstances(Class<T> type, ArgumentResolver argumentResolver) {
return SpringFactoriesLoader.forDefaultResourceLocation(getClassLoader(null)).load(type, argumentResolver); return SpringFactoriesLoader.forDefaultResourceLocation(getClassLoader()).load(type, argumentResolver);
} }
private ConfigurableEnvironment getOrCreateEnvironment() { private ConfigurableEnvironment getOrCreateEnvironment() {
@ -713,11 +713,10 @@ public class SpringApplication {
* @return a ClassLoader (never null) * @return a ClassLoader (never null)
*/ */
public ClassLoader getClassLoader() { public ClassLoader getClassLoader() {
return getClassLoader(ClassUtils.getDefaultClassLoader()); if (this.resourceLoader != null) {
} return this.resourceLoader.getClassLoader();
}
private ClassLoader getClassLoader(ClassLoader fallback) { return ClassUtils.getDefaultClassLoader();
return (this.resourceLoader != null) ? this.resourceLoader.getClassLoader() : fallback;
} }
/** /**