From 29c83bfd76d47b29e0d43fce204bfc45b3a447f3 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 21 Jul 2021 10:57:30 +0100 Subject: [PATCH] Instantiate detectors with ClassLoader that discovered them Fixes gh-27422 --- .../dependency/DatabaseInitializationDependencyConfigurer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/sql/init/dependency/DatabaseInitializationDependencyConfigurer.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/sql/init/dependency/DatabaseInitializationDependencyConfigurer.java index 5b58f96416..a542f5b1ab 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/sql/init/dependency/DatabaseInitializationDependencyConfigurer.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/sql/init/dependency/DatabaseInitializationDependencyConfigurer.java @@ -162,7 +162,7 @@ public class DatabaseInitializationDependencyConfigurer implements ImportBeanDef List names = SpringFactoriesLoader.loadFactoryNames(type, beanFactory.getBeanClassLoader()); Instantiator instantiator = new Instantiator<>(type, (availableParameters) -> availableParameters.add(Environment.class, this.environment)); - return instantiator.instantiate(names); + return instantiator.instantiate(beanFactory.getBeanClassLoader(), names); } private static BeanDefinition getBeanDefinition(String beanName, ConfigurableListableBeanFactory beanFactory) {