@Service
public abstract class MainService<E extends AbstractEntity, R extends MainRepository<E>> {
@Autowired
MainRepository<E> repository;
public E find(long id) throws Exception {
return this.repository.find(---, id);
}
}
Here is it possible to find the class reference of the generic type E to pass through this method as first argument instead of the --- ...?
My expectation about the implementation is to create a generic call to avoid the repetition of the below code in all service classes.
return this.repository.find(Entity.class,id);