title: How to validate XML REST request in Springboot with Jaxb?
body: <p>I thought this would be as easy as adding an annotation but I can't find a solution to this.</p>
  
  <p>I have a simple endpoint that takes an XML request body:</p>
  
  <pre><code>@RequestMapping(value = "/import", method = RequestMethod.POST, consumes = MediaType.TEXT_XML_VALUE)
  public ResponseEntity&lt;Result&gt; importReceipts(@Valid @RequestBody ImportRequest request) throws Exception {
  </code></pre>
  
  <p>Where ImportRequest is a JAXB class generated from an XSD. This works fine when a client sends a request, but if the request is not valid there is not error. </p>
  
  <p>Please can anyone suggest the best way to validate this request body given the XSD?</p>
  
  <p>Thanks</p>