I'm developing Jersey-based RESTful Web Services. And, I'm choosing between DeltaSpike Data and Spring Data JPA for my repository layer. I have tried both of them. I'm amazed that they are almost the same.
DeltaSpike Data:
public interface AuthorRepository extends EntityRepository<Author, Long> {
}
Spring Data JPA:
public interface AuthorRepository extends CrudRepository<Author, Long> {
}
But my problem is not as to which one is better and I should choose but, how to apply HK2 dependency injection.
By manually creating AuthorRepository and AuthorRepositoryImpl, I can simply do this configuration:
public class ApplicationBinder extends AbstractBinder {
@Override
protected void configure() {
bind(AuthorRepositoryImpl.class).to(AuthorRepository.class).in(RequestScoped.class);
}
}
But I could not figure out how to apply above similar configuration if I use either DeltaSpike Data or Spring Data JPA since there is not an implementation class for repository interface.
Any help will be appreciated. Thank you.