diff --git a/spring-context/src/main/java/org/springframework/context/aot/RuntimeHintsBeanFactoryInitializationAotProcessor.java b/spring-context/src/main/java/org/springframework/context/aot/RuntimeHintsBeanFactoryInitializationAotProcessor.java index c83224f4b4..b429e12ebb 100644 --- a/spring-context/src/main/java/org/springframework/context/aot/RuntimeHintsBeanFactoryInitializationAotProcessor.java +++ b/spring-context/src/main/java/org/springframework/context/aot/RuntimeHintsBeanFactoryInitializationAotProcessor.java @@ -57,7 +57,7 @@ class RuntimeHintsBeanFactoryInitializationAotProcessor public BeanFactoryInitializationAotContribution processAheadOfTime( ConfigurableListableBeanFactory beanFactory) { Map, RuntimeHintsRegistrar> registrars = AotServices - .factoriesAndBeans(beanFactory).load(RuntimeHintsRegistrar.class).stream() + .factories(beanFactory.getBeanClassLoader()).load(RuntimeHintsRegistrar.class).stream() .collect(LinkedHashMap::new, (map, item) -> map.put(item.getClass(), item), Map::putAll); extractFromBeanFactory(beanFactory).forEach(registrarClass -> registrars.computeIfAbsent(registrarClass, BeanUtils::instantiateClass));