I want all the Service
classes in my backend to have CRUD methods.
For that purpose, I thought of creating an interface:
public interface ServiceCRUD {
public Object save(Object object);
...
}
And then on my service, implement it:
@Service
public class SampleService implements ServiceCRUD {
@Autowired
private SampleRepository repository;
@Override
public Sample save(Sample sample) {
return repository.save(sample);
}
...
}
I haven't touched Java in a while, but if I recall correctly, every object extend Object
, so why is it that I can't use Object to have the service accept all the entities I might have?
Best regards