Look up bean merged bean definitions in Repositories.

We now look up bean definitions for repositories using BeanFactory.getMergedBeanDefinition(…) to consider parent-child relationships across application contexts.

As we iterate through bean definitions considering ancestors we need to allow parent bean definitions. Previously, we obtained the bean definition from the child context and since the bean was inherited from the parent, the child context cannot provide a bean definition.

Closes #2383
Original pull request: #2384.
This commit is contained in:
Pavel Gnusin
2021-06-16 17:21:57 +03:00
committed by Mark Paluch
parent 0cbc344483
commit c383024312

View File

@@ -306,7 +306,7 @@ public class Repositories implements Iterable<Class<?>> {
return null;
});
Boolean presentAndPrimary = factoryToUse.map(it -> it.getBeanDefinition(name)) //
Boolean presentAndPrimary = factoryToUse.map(it -> it.getMergedBeanDefinition(name)) //
.map(BeanDefinition::isPrimary) //
.orElse(false);