Description
Affected Version: 5.3.28
There seems to be an issue with Spring ORM SpringBeanContainer
when Hibernate tries to create a bean using the SpringBeanContainer::createBean
method:
SpringContainedBean<?> createBean(String name, Class<?> beanType, LifecycleOptions lifecycleOptions, BeanInstanceProducer fallbackProducer)
Upon the creation of a bean, the method this.beanFactory.applyBeanPropertyValues(bean, name);
is called. This method internally attempts to merge the bean definition. However, the definition does not exist and cannot be created by the developer due to Hibernate appending a counter suffix to the bean name (e.g., org.example.types.CustomType0
). This causes the entire process to fail with the error message "No bean named org.example.types.CustomType0
," ultimately resorting to Hibernate's fallback method for bean creation. This negates the intended purpose of using the SpringBeanContainer
for bean creation.
A review of the code history suggests that this behavior has remained unchanged for quite some time. However, this approach appears to be flawed and may need to be reconsidered to ensure the proper functioning of the integration between Spring ORM and Hibernate when dealing with the creation of beans.