1

I check documentation of spring for doing custom method

interface UserRepositoryCustom {
  public void someCustomMethod(User user);
}

class UserRepositoryImpl implements UserRepositoryCustom {

  public void someCustomMethod(User user) {
    // Your custom implementation
  }
}

What is need to do if i need to use some standard rempository method (find, delete...) in UserRepositoryImpl?

robert trudel
  • 5,283
  • 17
  • 72
  • 124
  • 1
    Possible duplicate of [How to reference the 'normal' spring data repo from a custom implementation?](https://stackoverflow.com/questions/28361275/how-to-reference-the-normal-spring-data-repo-from-a-custom-implementation) – manish Sep 04 '17 at 10:48
  • Don't forget to accept/upvote answers that helped you... – Cepr0 Sep 23 '17 at 13:45

1 Answers1

0

I think to inject a standard repo:

@Repository
class CrudRepositoryImpl implements UserRepositoryCustom {

  @Autoware 
  private JpaRepository<User, Long> userRepo;

  public void someCustomMethod(User user) {

    // Your custom implementation

    userRepo.save(user);
  }
} 

The prove.

Cepr0
  • 28,144
  • 8
  • 75
  • 101