You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
BeanFactoryUtils.beanNamesForTypeIncludingAncestors(factory, RepositoryFactoryInformation.class, false, false) doesn't find beans that are found in 4.1 [SPR-12846] #17444
A Spring Data JPA-based test is failing in Spring Boot when I upgrade to Spring Framework 4.2. The failure occurs because Spring Data's Repositories class fails to find the JpaRepositoryFactoryBean in the application context. It looks for it by calling BeanFactoryUtils.beanNamesForTypeIncludingAncestors(factory, RepositoryFactoryInformation.class, false, false)). RepositoryFactoryInformation is an interface that is implemented by JpaRepositoryFactoryInformation.
The problem looks like it may be due to the use of ResolvableType in 4.2. When run against Spring Framework 4.1.x, it boils down to AbstractBeanFactory.isTypeMatch calling org.springframework.data.repository.core.support.RepositoryFactoryInformation.class.isAssignableFrom(org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean.class). When run against Spring Framework 4.2 it's the ResolvableType for RepositoryFactoryInformation that's used. In 4.1.x the isAssignableFrom call returns true, in 4.2 it returns false. This is summarised in the following test: