Spring Boot CORS not working even after @CrossOrigin annotation
<p>I have the following code that handles a CORS request </p>

<pre><code>@CrossOrigin(origins = "*", methods = RequestMethod.PUT)
@RequestMapping(value = "/componentOrder", method = RequestMethod.PUT)
public @ResponseBody List&lt;Map&lt;String, Long&gt;&gt; syncComponentOrder(@PathVariable Long id,
        @RequestBody List&lt;Map&lt;String, Long&gt;&gt; orders) { ... }
</code></pre>

<p>Even though Spring documentation says that this should handle a CORS request correctly but my Chrome still reports an error: </p>

<p><a href="https://i.stack.imgur.com/FDXDu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FDXDu.png" alt="why is it internal server error?"></a>
<a href="https://i.stack.imgur.com/95Lic.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/95Lic.png" alt="detailed error message"></a></p>

<p>I need some help finding out why, the other CORS endpoints work perfectly. </p>