Using CustomRepository implemention with spring boot & spring-data-jpa

2015-10-14 spring hibernate spring-boot spring-data spring-data-jpa

Background

I'm trying to create a custom implementation for my spring boot data jpa application.

I've created a UserRepsitoryCustom interface with "List<User> getUsers(String type)" method.

I've created a UserRepository interface with extends CrudRepository<User, Long>, QueryDslPredicateExecutor<User>, UserRepositoryCustom.

I've created a UserRepositoryImpl class which extends UserRepositoryCustom interface and implements the "getUsers(String type)" method.

Problem

My expectation was that spring boot-data-jpa will create me a repository bean that combines all the goodies from CrudRepository & QueryDslPredicateExecutor and additional will know to use my custom implementation repository.

Currently, all I'm getting is

PropertyReferenceException: No property getUsers found...

I haven't annotated the UserRepositoryImpl with any @Component or @Repository. and I haven't changed any default configuration.

What am I doing wrong?

Thanks!

Answers

I've found my problem!!! The UserRepositoryImpl was in the wrong package name... I've moved it to the right package name and it's done!

Related