Browse Source

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.
2.5.x
Pavel Gnusin 5 years ago committed by Mark Paluch
parent
commit
7f61bce4d0
No known key found for this signature in database
GPG Key ID: 4406B84C1661DCD1
  1. 2
      src/main/java/org/springframework/data/repository/support/Repositories.java

2
src/main/java/org/springframework/data/repository/support/Repositories.java

@ -306,7 +306,7 @@ public class Repositories implements Iterable<Class<?>> { @@ -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);

Loading…
Cancel
Save