Sub-Sub Interface of Repository
Hello Friends,
I have a doubt concerning extending the Repository interface and it sub types (e.g. JpaRepository), that I could not made clear in the reference, forum and the issue tracker.
I'm working with two OSGi bundles:
In the first bundle I have one domain class and it's jpa repository interface (which extends the JpaRepository interface, and just add a findByAttribute method), which I'll call, just for clarification, DomainRepository.
In the second one I have just one empty interface (i.e. sub-sub-interface of JpaRepository) that extends the DomainRepository, that I'll call DomainService and from which I want to export an osgi service.
Now, the problem is, in runtime the bean for the DomainService cannot be created I not quite sure why. I get a IllegalArgumentException with the message:
Code:
You have custom methods in interface org.example.DomainService but not provided a custom implementation!
thrown by RepositoryFactorySupport.validate()
When I use the DomainRepository directly it works as expected. Because of some design choices we prefer the sub-sub-interface approach.
So, given the scenario, my question is: There's a limitation in the RepositoryFactorySupport that do not allow sub-sub-interfaces for the bean creation?
thanks in advance,
Paulo
Solution for the "sub-sub" interface problem
A solution for that was add in the interface a override of the method declared in the first interface, so:
Code:
public interface SpringDataVehicleAdminRepository extends AmbulanceVehicleRepository {
@Override
AmbulanceVehicle findByLabel(String label);
}
Now works fine.