Uploaded image for project: 'Spring IDE'
  1. Spring IDE
  2. IDE-1284

"Unsatisfied dependency" warning although bean is present

This issue belongs to an archived project. You can view it, but you can't modify it. Learn more

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 3.3.0.M2
    • 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.

      Attachments

        Activity

          People

            mlippert Martin Lippert
            olivergierke Oliver Drotbohm
            Archiver:
            tmarshall Trevor Marshall

            Dates

              Created:
              Updated:
              Resolved:
              Archived: