title: Spring MVC @RestController -> PUTting results in "400 Bad Request" no matter what I do
body: <p>I have a Spring RestController which works great when I <code>GET</code> data from it, but when I try to <code>PUT</code> the <em>very same data</em>, I get a <code>400 Bad Request</code>.</p>
  
  <p>Here is the simplest version of my controller that <strong>should</strong> still work (I left out the <code>GET</code> method):</p>
  
  <pre><code>@RestController
  @RequestMapping("/configuration/ledstrips/{name}/display")
  public class DisplayController {
  
      @ResponseBody
      @RequestMapping(method = RequestMethod.PUT, produces = { "application/hal+json" })
      public DisplayResource setDisplay(@PathVariable String name, @RequestBody DisplayResource display) {
  
          return display;
      }
  }
  </code></pre>
  
  <p>This is the <code>DisplayResource</code>:</p>
  
  <pre><code>public class DisplayResource extends ResourceSupport {
  
      private List&lt;Color&gt; pixels;
  
      public List&lt;Color&gt; getPixels() {
  
          return pixels;
      }
  
  
      public void setPixels(List&lt;Color&gt; pixels) {
  
          this.pixels = pixels;
      }
  }
  </code></pre>
  
  <p>I pretty much copied this code over from another branch, and there it works!</p>
  
  <p>I can't figure it out!</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Here's the <code>GET</code>-Method:</p>
  
  <pre><code>@ResponseBody
  @RequestMapping(method = RequestMethod.GET, produces = { "application/hal+json" })
  public DisplayResource getDisplay(@PathVariable String name) {
  
      LEDStripDTO ledStripDTO;
  
      try {
          ledStripDTO = ledStripDTOService.getDTO(name);
      } catch (IOException | NullPointerException exception) {
          throw new LoadFailedException("Error loading LED strip:", exception);
      }
  
      Link self = linkTo(methodOn(DisplayController.class).getDisplay(name)).withSelfRel();
  
      DisplayResource displayResource = new DisplayResource();
  
      displayResource.add(self);
  
      try {
          displayResource.setPixels(ledStripService.getPixels(ledStripDTO));
      } catch (IOException | TimeoutException | AlreadyConnectedException | NotConnectedException exception) {
          throw new LoadFailedException("Error getting Information from LED strip:", exception);
      }
  
      return displayResource;
  }
  </code></pre>
  
  <p>And a result it produces (for a LED strip of length 1):</p>
  
  <pre><code>{
    "pixels": [
      {
        "red": 0,
        "green": 16,
        "blue": 0
      }
    ],
    "_links": {
      "self": {
        "href": "http://localhost:8080/configuration/ledstrips/devled/display"
      }
    }
  }
  </code></pre>
  
  <p>When I send this, be it with or without the <code>_links</code> segment, I get a <code>400</code> error.</p>