@RequiredArgsConstructor public class CreateProductService implements CreateProductUseCase private final ProductRepository productRepository; // depends on outgoing port
// domain/spi/ProductRepository.java (Outgoing Port) package com.example.domain.spi; import com.example.domain.model.Product; import java.util.Optional; designing hexagonal architecture with java pdf
// adapters/web/ProductController.java package com.example.adapters.web; import com.example.application.port.in.CreateProductUseCase; import com.example.application.port.in.CreateProductUseCase.CreateProductCommand; import com.example.domain.model.Product; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.*; @RestController @RequiredArgsConstructor public class ProductController private final CreateProductUseCase createProductUseCase; // depends on incoming port // depends on incoming port