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

"Unsatisfied dependency" warning although bean is present

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.3.0.M2
    • Component/s: None
    • Labels:
      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

            Assignee:
            mlippert Martin Lippert
            Reporter:
            olivergierke Oliver Drotbohm
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: