Uploaded image for project: 'Spring Data JPA'
  1. Spring Data JPA
  2. DATAJPA-221

<jpa:repositories base-package="..." /> hides legacy @Repository annotated beans

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Works as Designed
    • Affects Version/s: 1.1 GA
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:
      Spring 3.0.0, Java 6, WinXP

      Description

      After adding <jpa:repositories base-package="..." /> any existing @Repository annotated spring bean is no longer available for injection causing

      No matching bean of type [...] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency
      

      (speculation)
      In log I can see, that bean is still created, but perhaps because it does not implements any interface, it is proxied and because of that, it is not of it's original type and cannot be injected.
      (/speculation)

      Changing @Repository to @Component will make bean available again, so it is obvious that jpa:repositories and @Repository is deadly combination. But this is not a option this because we use exception translation in @Repository beans.
      Why is jpa scan messing with @Repository beans anyway? Why it cannot be at least disabled by @NoRepositoryBean annotation?
      It is VERY invasive behaviour preventing us usinf this cool tool

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              olivergierke Oliver Drotbohm
              Reporter:
              anthavio Martin Vanek
              Last updater:
              Trevor Marshall
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: