quick question. I'm using Spring Boot and I created e.g. this class
public interface ProductService {
Page<Product> getPage(Pageable pageable);
}
@Service
public class ProductServiceImpl implements ProductService {
@Autowired
private ProductRepository productRepository;
@Override
public Page<Product> getPage(String name, Pageable pageable) {
return productRepository.findAll(pageable);
}
}
And this interface has only one implementation. And what is better to use interface with one implementation and inject interface or just create a class without interface and inject class?