title: Spring WebFlux - how to return a different type than Mono source?
body: <p>Doing my first steps with Spring Reactor, I'm struggling how the RestController can return a different bean the input parameter. I've the following method:</p>
  
  <pre><code>@PostMapping
  public Mono&lt;Site&gt; create( @RequestBody Publisher&lt;Site&gt; site )
  {
      return Mono.
              from( site ).
              doOnNext( repository::save);
  }
  </code></pre>
  
  <p>Assuming repository::save returns a boolean to indicate success or failure, how can one grab this returned value and use it to return some custom DTO in response? So final method will looks something like:</p>
  
  <pre><code>@PostMapping
  public Mono&lt;SomeResponse&gt; create( @RequestBody Publisher&lt;Site&gt; site )
  {
      return Mono.
              from( site ).
              doOnNext( repository::save)
              .someCodeThatGetTheReturnedValueAndReturnsSomeResponse;
  }
  </code></pre>