title: Spring Webflux - reactive repository saveAll(Iterable<S>) vs saveAll(Publisher<S>)
body: <p>Small question about the webflux reactive repository, especially about the methods saveAll   Flux saveAll(Iterable var1); versus  Flux saveAll(Publisher var1);</p>
  <p>Wanted to compare, I wrote the following:</p>
  <pre><code>@Controller
  @SpringBootApplication
  public class Application {
  
      public static void main(String[] args) {
          SpringApplication.run(Application.class);
      }
  
      @Autowired
      private SomeReactiveRepository someReactiveRepository;
  
      @PostMapping(path = &quot;/saveListInsideMono&quot;, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
      public Mono&lt;QuestionResponse&gt; saveListInsideMono(@RequestBody Mono&lt;QuestionRequest&gt; questionRequestMono) {
          //just doing some business transformation on the list inside the mono
          Mono&lt;List&lt;String&gt;&gt; enhancedStringListMono = questionRequestMono.map(questionRequest -&gt; enhance(questionRequest));
          //take the pojo inside the mono and map it to a saveAllAndConvertToResponse method (see next method)
          Mono&lt;QuestionResponse&gt; questionResponseMono = enhancedStringListMono.map(enhancedStringList -&gt; saveAllAndConvertToResponse(enhancedStringList));
          return questionResponseMono;
      }
  
      private QuestionResponse saveAllAndConvertToResponse(List&lt;String&gt; enhancedStringList) {
          // use the repository &lt;S extends T&gt; Flux&lt;S&gt; saveAll(Iterable&lt;S&gt; var1); + subscribe
          return someReactiveRepository.saveAll(enhancedStringList).thenReturn(new QuestionResponse(enhancedStringList));
      //this also works but not good to subscribe
          //someReactiveRepository.saveAll(enhancedStringList).subscribe();
          //return new QuestionResponse(enhancedStringList);
      }
  
      @PostMapping(path = &quot;/saveFlux&quot;, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
      public Mono&lt;QuestionResponse&gt; saveFlux(@RequestBody Mono&lt;QuestionRequest&gt; questionRequestMono) {
          //just doing some business transformation on the list inside the mono
          Mono&lt;List&lt;String&gt;&gt; enhancedStringListMono = questionRequestMono.map(questionRequest -&gt; enhance(questionRequest));
          // use the repository &lt;S extends T&gt; Flux&lt;S&gt; saveAll(Publisher&lt;S&gt; var1); to save the flatMapMany + fromIterable directly
          Flux&lt;String&gt; enhancedStringFlux = someReactiveRepository.saveAll(enhancedStringListMono.flatMapMany(Flux::fromIterable));
          Mono&lt;QuestionResponse&gt; questionResponseMono = enhancedStringFlux.collectList().map(enhancedString -&gt; convertToResponse(enhancedString));
          return questionResponseMono;
      }
  
      private QuestionResponse convertToResponse(List&lt;String&gt; enhancedStringList) {
          //return the object needed
          return new QuestionResponse(enhancedStringList);
      }
  
      private static List&lt;String&gt; enhance(QuestionRequest questionRequest) {
          //dummy business transformation logic
          List&lt;String&gt; baseList = questionRequest.getList();
          List&lt;String&gt; enhancedList = baseList.stream().map(oneString -&gt; &quot;enhanced&quot; + oneString).collect(Collectors.toList());
          return enhancedList;
      }
  
      public class QuestionRequest {
          private List&lt;String&gt; list;
  
          public List&lt;String&gt; getList() {
              return list;
          }
      }
  
      public class QuestionResponse {
          private List&lt;String&gt; enhancedList;
  
          public QuestionResponse(List&lt;String&gt; enhancedList) {
              this.enhancedList = enhancedList;
          }
      }
  
  }
  
  </code></pre>
  <p>In terms of &quot;correctness&quot; both codes are doing what is expected. Everything is persisted successfully.</p>
  <p>But in terms of performance, reactive paradigm, IO Utilisations to DB, Netty Core usage, what is the &quot;best&quot; solution and why please?</p>
  <p>Thank you</p>