I'm trying to add custom repository methods in Spring as show in the documentation here:
and in a Stack Overflow question here:
How to add custom method to Spring Data JPA
and it's not working as expected.
I took the repository, defined as:
public interface ScreenshotRepository extends JpaRepository<Screenshot, UUID> {
and changed it to
public interface ScreenshotRepository extends JpaRepository<Screenshot, UUID>, ScreenshotRepositoryCustom {
Then I created the ScreenshotRepositoryCustom
interface:
interface ScreenshotRepositoryCustom {
void foo();
}
and the implementation:
class ScreenshotRepositoryCustomImpl implements ScreenshotRepositoryCustom {
@Override
public void foo() {
System.out.println("Foo!!!");
}
}
When I try to start the spring application, I get this message:
Error creating bean with name 'screenshotRepository': Invocation of init method failed; nested exception is org.springframework.data.mapping.PropertyReferenceException: No property foo found for type Screenshot!
which I'm having trouble understanding. What's going on here?