findAll

Service

public List<ProductDTO> findAll() {
    List<Product> products = repository.findAll();

    return products.stream().map(ProductDTO::new).toList();
}

Controller

@GetMapping
public ResponseEntity<List<ProductDTO>> findAll() {
    List<ProductDTO> dto = productService.findAll();
    return ResponseEntity.ok().body(dto);
}

Atualizado