mirror of
https://github.com/spring-projects/spring-boot.git
synced 2026-09-17 12:09:16 +00:00
Use beanClassLoader when checking excluded auto-configuration classes
When validating exclusions, prefer the selector's beanClassLoader for ClassUtils.isPresent checks and fall back to the selector class loader if the beanClassLoader is not set. This makes presence checks consistent with the classloader context used for loading auto-configuration candidates. See gh-48129 Signed-off-by: linw-bai <107357009+linw-bai@users.noreply.github.com>
This commit is contained in:
committed by
Stéphane Nicoll
parent
2f1f964a2a
commit
8bcab02efd
+2
-1
@@ -205,8 +205,9 @@ public class AutoConfigurationImportSelector implements DeferredImportSelector,
|
||||
|
||||
private void checkExcludedClasses(List<String> configurations, Set<String> exclusions) {
|
||||
List<String> invalidExcludes = new ArrayList<>(exclusions.size());
|
||||
ClassLoader classLoader = (this.beanClassLoader != null) ? this.beanClassLoader : getClass().getClassLoader();
|
||||
for (String exclusion : exclusions) {
|
||||
if (ClassUtils.isPresent(exclusion, getClass().getClassLoader()) && !configurations.contains(exclusion)) {
|
||||
if (ClassUtils.isPresent(exclusion, classLoader) && !configurations.contains(exclusion)) {
|
||||
invalidExcludes.add(exclusion);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user