java-extensions icon indicating copy to clipboard operation
java-extensions copied to clipboard

Dependency to JPA Repository that implements another interface

Open carljonescf opened this issue 4 years ago • 0 comments

I have a JPARepository that implements another interface. The idea being that alternative implementations of the same interface could be applied. It's a conversation starter with students.

e.g.

public interface CharityRepositoryJPA extends JpaRepository<Charity, Long> , CharityRepository

I then have a service class that depends on CharityRepository. The Spring extension picks up the JPA repository as a component, but doesn't pick up the dependency.

Is there a way of naming the interfaces so that the dependencies are picked up correctly? At the moment, I seem to have to make the service class depend on the JPA interface directly.

Thanks

carljonescf avatar Nov 05 '21 13:11 carljonescf