Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
I see the warning (as can be seen in the attached screenshot) pointing out that Spring Data repository beans cannot be found in the ApplicationContext although the beans are present (see Spring Explorer node in the upper left corner).
The setup is as follows:
1. Have a Spring Data repository interface declared
2. Activate Spring Data JPA through <jpa:repositories //>
3. Create a client class trying to get the beans injected
The Spring RESTBucks project should produce this error out of the box. Here's what I suspect to cause the issue:
Spring Data repositories are created through a FactoryBean. The Spring Data namespace registeres a special SmartInstantiationAwareBeanPostProcessor that predicts the final bean type (see RepositoryInterfaceAwareBeanPostProcessor) to prevent it to be eagerly instantiated. The IDE support probably only considers the primary bean type (the factory bean one) and thus fails to resolve the bean here.
The special node in the Spring Explorer actually uses a Spring Data IDE extension essentially re-implementing the type prediction.