title: Add a list of customers to an object in Spring
body: <p>I have this object that I'm retrieving from antoher microservice.</p>
  <pre><code>@Service
  public class WebClientService {
  
  
      public Mono&lt;CuCoPerson&gt; getCuCoPerson(Integer cucoId, String GS_AUTH_TOKEN) {
          WebClient webClient = WebClient.create();
  
          return webClient.get()
                  .uri(GET_RELATION_BY_ID + cucoId)
                  .header(&quot;Accept&quot;, &quot;application/json&quot;)
                  .header(&quot;Authorization&quot;, GS_AUTH_TOKEN)
                  .retrieve()
                  .bodyToMono(CuCoPerson.class)
                  .map(cuCoPerson -&gt; {
                      List&lt;CustomerRelation&gt; matches = cuCoPerson.getRelatedCustomers()
                              .stream()
                              .filter(relation -&gt; relation.getSystemId().equals(400) || relation.getSystemId().equals(300) || relation.getSystemId().equals(410))
                              .filter(relation -&gt; relation.getCustomerId().contains(&quot;F&quot;))
                              .collect(Collectors.toList());
                      cuCoPerson.setRelatedCustomers(matches);
                      return cuCoPerson;
                  });
      }
  </code></pre>
  <p>The controller is as follows:</p>
  <pre><code>@GetMapping(&quot;/getCucoId/{cucoId}&quot;)
      public Mono&lt;CuCoPerson&gt; getCucoRelationById(@PathVariable Integer cucoId, @RequestHeader(value=&quot;Authorization&quot;) String GS_AUTH_TOKEN) {
  
          return webClientService.getCuCoPerson(cucoId, GS_AUTH_TOKEN);
      }
  </code></pre>
  <p>It returns a list of related customers like this:</p>
  <pre><code>{
      &quot;id&quot;: 1,
          &quot;relatedCustomers&quot;: [
              {
                  &quot;customerId&quot;: &quot;xxx&quot;,
                  &quot;systemId&quot;: 999
              }
          ]
  }
  </code></pre>
  <p>And now I need to add this list of customers to my PeopleDTO class which is as follows:</p>
  <pre><code>public class PeopleDTO {
  
      private String processType;
      private String operation;
      private String entity;
      private String entityType;
      private Long id;
      private Document document;
  
      @Getter
      @Setter
      class Customer {
          private String systemId;
          private String customerId;
      }
      private List&lt;Customer&gt; customers;
  }
  </code></pre>
  <p>UPDATE:</p>
  <p>Here I'm hardcoding my PeopleDTO just as an example:</p>
  <pre><code>public PeopleDTO createPeople(Long id) {
          PeopleDTO people = new PeopleDTO();
          people.setProcessType(&quot;ONLINE&quot;);
          people.setOperation(&quot;UPDATE&quot;);
          people.setEntity(&quot;DOCUMENT&quot;);
          people.setEntityType(&quot;DOCUMENT&quot;);
          people.setIdCuco(id);
          people.setDocument(new Document());
          people.setCustomers(......);
  
      }
  </code></pre>
  <p>So the result should be something like this:</p>
  <pre><code>{
      &quot;type&quot;: &quot;ONLINE&quot;,
      &quot;operation&quot;: &quot;UPDATE&quot;,
      &quot;id&quot;: 1,
      &quot;entity&quot;: &quot;DOCUMENT&quot;,
      &quot;entityType&quot;: &quot;NIE&quot;,
      &quot;documents&quot;: {
          &quot;id&quot;: 1,
          &quot;additionals&quot;: {
              &quot;issuing_authority&quot;: &quot;Spain&quot;,
              &quot;country_doc&quot;: &quot;ES&quot;,
              &quot;place_of_birth&quot;: &quot;&quot;,
              &quot;valid_from&quot;: &quot;1995-08-09&quot;,
              &quot;valid_to&quot;: &quot;0001-01-01&quot;
          },
          &quot;code&quot;: &quot;X12345&quot;,
          &quot;typeDocument&quot;: &quot;NIE&quot;
      },
      &quot;id&quot;: 1,
      &quot;relatedCustomers&quot;: [
          {
              &quot;customerId&quot;: &quot;xxx&quot;,
              &quot;systemId&quot;: 999
          }
      ]
  }
  </code></pre>
  <p>The controller that supposed to retrieve this info is:</p>
  <pre><code>@GetMapping(&quot;getId/{cucoId}&quot;)
      public PeopleDTO getFullPeople(@PathVariable Long id) {
          return webClientService.createPeople(id);
      }
  </code></pre>
  <p>How should I set the customers in here?</p>