Browse Source

Don't look for RuntimeHintsRegistrar beans

Update `RuntimeHintsBeanFactoryInitializationAotProcessor` so
that `RuntimeHintsRegistrar` beans are not loaded.

See gh-28866
pull/30304/head
Phillip Webb 2 years ago
parent
commit
d33c2b52cc
  1. 2
      spring-context/src/main/java/org/springframework/context/aot/RuntimeHintsBeanFactoryInitializationAotProcessor.java

2
spring-context/src/main/java/org/springframework/context/aot/RuntimeHintsBeanFactoryInitializationAotProcessor.java

@ -57,7 +57,7 @@ class RuntimeHintsBeanFactoryInitializationAotProcessor
public BeanFactoryInitializationAotContribution processAheadOfTime( public BeanFactoryInitializationAotContribution processAheadOfTime(
ConfigurableListableBeanFactory beanFactory) { ConfigurableListableBeanFactory beanFactory) {
Map<Class<? extends RuntimeHintsRegistrar>, RuntimeHintsRegistrar> registrars = AotServices Map<Class<? extends RuntimeHintsRegistrar>, 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); .collect(LinkedHashMap::new, (map, item) -> map.put(item.getClass(), item), Map::putAll);
extractFromBeanFactory(beanFactory).forEach(registrarClass -> extractFromBeanFactory(beanFactory).forEach(registrarClass ->
registrars.computeIfAbsent(registrarClass, BeanUtils::instantiateClass)); registrars.computeIfAbsent(registrarClass, BeanUtils::instantiateClass));

Loading…
Cancel
Save