diff --git a/persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/service/ProductService.java b/persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/service/ProductService.java index 03f3ba39cd..49d07ca5a2 100644 --- a/persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/service/ProductService.java +++ b/persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/service/ProductService.java @@ -13,8 +13,12 @@ import java.util.Optional; @Component public class ProductService { - @Autowired private ProductRepository repository; + + @Autowired + public ProductService(ProductRepository repository) { + this.repository = repository; + } public List findProductByName(String productName) { return repository.findByProductName(productName);