title: How to rewrite a PostMapping request method to post a list of objects in Jhipster project
body: <p>I generated a project using Jhipster, and I have the generated method below that allows me to save one &quot;productDTO&quot;, and I would like to rewrite that method to save a list of &quot;productDTOS&quot; for my project.
  I can change the parameters to List&lt;ProductDTOS&gt; and add a for loop to save each productDTO, but I don't really know how to change the return part to match my requirment.</p>
  <pre><code>/**
       * {@code POST  /products} : Create a new product.
       *
       * @param productDTO the productDTO to create.
       * @return the {@link ResponseEntity} with status {@code 201 (Created)} and with body the new productDTO, or with status {@code 400 (Bad Request)} if the product has already an ID.
       * @throws URISyntaxException if the Location URI syntax is incorrect.
       */
      @PostMapping(&quot;/products&quot;)
      public ResponseEntity&lt;ProductDTO&gt; createProduct(@Valid @RequestBody ProductDTO productDTO) throws URISyntaxException {
          log.debug(&quot;REST request to save Product : {}&quot;, productDTO);
          if (productDTO.getId() != null) {
              throw new BadRequestAlertException(&quot;A new product cannot already have an ID&quot;, ENTITY_NAME, &quot;idexists&quot;);
          }
          ProductDTO result = productService.save(productDTO);
          return ResponseEntity
              .created(new URI(&quot;/api/products/&quot; + result.getId()))
              .headers(HeaderUtil.createEntityCreationAlert(applicationName, false, ENTITY_NAME, result.getId().toString()))
              .body(result);
      }
  </code></pre>