title: Using Spring @RestController with @QuerydslPredicate to handle GET With ZonedDateTime parameters
body: <p>Im creating an endpoint that will receive dates to do some filtering on the serverside. The code looks like this:</p>
  
  <pre><code>@RequestMapping(value = "/invoices", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
  @Timed
  public ResponseEntity&lt;List&lt;Invoice&gt;&gt; getAllInvoices(@QuerydslPredicate(root = Invoice.class) Predicate predicate, Pageable pageable) throws URISyntaxException {
      log.debug("REST request to get a page of Invoices");
      Page&lt;Invoice&gt; page = invoiceService.findAll(predicate, pageable);
      HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/invoices");
      return new ResponseEntity&lt;&gt;(page.getContent(), headers, HttpStatus.OK);
  }
  </code></pre>
  
  <p>When I try to invoke the endpoint with this url: <code>http://localhost:3000/api/invoices?page=0&amp;size=20&amp;sort=id,asc&amp;sort=id&amp;transactionDate=2016-05-09T22:00:00.000Z&amp;transactionDate=2016-05-17T21:59:59.999Z</code> </p>
  
  <p>This exception is thrown: </p>
  
  <pre><code>java.time.format.DateTimeParseException: Text '2016-05-09T22:00:00.000Z' could not be parsed at index 10
      at java.time.format.DateTimeFormatter.parseResolved0(DateTimeFormatter.java:1949) ~[na:1.8.0_91]
      at java.time.format.DateTimeFormatter.parse(DateTimeFormatter.java:1851) ~[na:1.8.0_91]
      at java.time.ZonedDateTime.parse(ZonedDateTime.java:597) ~[na:1.8.0_91]
      at org.springframework.format.datetime.standard.TemporalAccessorParser.parse(TemporalAccessorParser.java:80) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
      at org.springframework.format.datetime.standard.TemporalAccessorParser.parse(TemporalAccessorParser.java:47) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
      at org.springframework.format.support.FormattingConversionService$ParserConverter.convert(FormattingConversionService.java:194) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
      at org.springframework.core.convert.support.ConversionUtils.invokeConverter(ConversionUtils.java:35) ~[spring-core-4.2.4.RELEASE.jar:4.2.4.RELEASE]
      at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:192) ~[spring-core-4.2.4.RELEASE.jar:4.2.4.RELEASE]
      at org.springframework.data.querydsl.binding.QuerydslPredicateBuilder.convertToPropertyPathSpecificType(QuerydslPredicateBuilder.java:217) ~[spring-data-commons-1.11.2.RELEASE.jar:na]
  ..... etc etc
  </code></pre>
  
  <p>Parsing the given dates <a href="http://ideone.com/pKEpTR" rel="nofollow noreferrer">works (on ideone.com)</a> using just the ZonedDateTime object, but ok something else might be wrong. I found this question on SO: <a href="https://stackoverflow.com/questions/32512782/using-spring-restcontroller-to-handle-http-get-with-zoneddatetime-parameters">Using Spring @RestController to handle HTTP GET with ZonedDateTime parameters</a></p>
  
  <pre><code>@RequestMapping(value = "/invoices", params="action", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
  @Timed
  public ResponseEntity&lt;List&lt;Invoice&gt;&gt; findInvoices(@RequestParam("dt") @DateTimeFormat(iso=ISO.DATE_TIME) ZonedDateTime dt,Pageable pageable) throws URISyntaxException {
      log.debug("REST request to get a page of Invoices");
      Page&lt;Invoice&gt; result = invoiceRepository.findAllByTransactionDate(dt,pageable);
      HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(result, "/api/invoices");
      return new ResponseEntity&lt;&gt;(result.getContent(), headers, HttpStatus.OK);
  }
  </code></pre>
  
  <p>Requesting the url: <code>localhost:8080/api/invoices?action=search&amp;dt=2016-05-13T15:12:33.658Z</code> Gives the desired effect.. </p>
  
  <p>The obvious difference is the <code>@DateTimeFormat(iso=ISO.DATE_TIME)</code> addition to the requestparam. Now I'm wondering; how do i actually get that to work with the QueryDslPredicateBuilder? Should I somehow typehint the format? </p>