Announcement Announcement Module
No announcement yet.
Spring Data JPA Custom Repository Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring Data JPA Custom Repository

    I'm currently learning to use Spring Data JPA and ran into a problem while making repository extend a custom repository.

    The custom repository interface is not getting wired in automatically in my context. I'm getting the following error

    Registering repository: acLockRepository - Interface: com.s2dataaccess.repository.AcLockRepository -
    Factory: aRepositoryFactoryBean, - Custom implementation: null

    The custom implementation is null when it should not be

    This results in following

    java.lang.IllegalArgumentException: No property <xxx> found for type class where xxx is the prefix for the method

    in my context file i've the following entry <jpa:repositories base-package="com.s2dataaccess.repository"/> and have included the custom repository impl bean, similar to the examp.

    Am i missing something ??

  • #2
    I have the exact same issue. Any solutions yet?


    • #3
      Would you mind posting the declarations of your repo and custom repo interface, custom repo implementation plus the packages the types are located in?


      • #4
        I had the same problem, and I finally figured that it was a naming issue -- this pattern is a little goofy, but what I originally had was the following set of classes/interfaces:

        --interface MyDocumentRepositoryCustom
        --class MyDocumentRepositoryCustomImpl implements MyDocumentRepositoryCustom
        --interface MyDocumentRepository implements CrudRepository<...,...>, MyDocumentRepositoryCustom

        The problem is in the naming of my class -- the naming pattern specifies that it should be the name of the repository with 'Impl' appended. So changing it from MyDocumentRepositoryCustomImpl to MyDocumentRepositoryImpl solved my problem.

        Note that it appears that you can change the suffix, but I don't see any support for things like locating the class in another package, or using a completely different pattern.



        • #5
          If you'd like to see a more general configuration option feel free to open a JIRA ticket. We could also scan all sub-packages of the one the actual repository interface is found in. Either way a ticket makes sense here .