title: Spring webflux and reading from database
body: <p>Spring 5 introduces the reactive programming style for rest APIs with <a href="http://docs.spring.io/spring-framework/docs/5.0.0.BUILD-SNAPSHOT/spring-framework-reference/html/web-reactive.html" rel="noreferrer">webflux</a>. I'm fairly new to it myself and was wondering wether wrapping synchronous calls to a database into <code>Flux</code> or <code>Mono</code> makes sense preformence-wise? If yes, is this the way to do it: </p>
  
  <pre><code>@RestController
  public class HomeController {
  
      private MeasurementRepository repository;
  
      public HomeController(MeasurementRepository repository){
          this.repository = repository;
      }
  
      @GetMapping(value = "/v1/measurements")
      public Flux&lt;Measurement&gt; getMeasurements() {
          return Flux.fromIterable(repository.findByFromDateGreaterThanEqual(new Date(1486980000L)));
      }
  
  }
  </code></pre>
  
  <p>Is there something like an asynchronous CrudRepository? I couldn't find it.</p>