diff --git a/hibernate-core/src/main/java/org/hibernate/resource/beans/internal/CompositeManagedBeanRegistry.java b/hibernate-core/src/main/java/org/hibernate/resource/beans/internal/CompositeManagedBeanRegistry.java index 02793165bb..be44d26b70 100644 --- a/hibernate-core/src/main/java/org/hibernate/resource/beans/internal/CompositeManagedBeanRegistry.java +++ b/hibernate-core/src/main/java/org/hibernate/resource/beans/internal/CompositeManagedBeanRegistry.java @@ -86,6 +86,10 @@ public class CompositeManagedBeanRegistry return fallback.getBean( beanName, beanContract,shouldRegistryManageLifecycle ); } + @Override + public ManagedBeanRegistry getPrimaryBeanRegistry() { + return primaryRegistry; + } // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Optional delegation diff --git a/hibernate-core/src/main/java/org/hibernate/resource/beans/spi/ManagedBeanRegistry.java b/hibernate-core/src/main/java/org/hibernate/resource/beans/spi/ManagedBeanRegistry.java index 1846383014..3e9cd05753 100644 --- a/hibernate-core/src/main/java/org/hibernate/resource/beans/spi/ManagedBeanRegistry.java +++ b/hibernate-core/src/main/java/org/hibernate/resource/beans/spi/ManagedBeanRegistry.java @@ -46,4 +46,8 @@ public interface ManagedBeanRegistry extends Service { * the release calls itself. */ ManagedBean getBean(String beanName, Class beanContract, boolean shouldRegistryManageLifecycle); + + default ManagedBeanRegistry getPrimaryBeanRegistry() { + return this; + } }