Spring, @PathVariable, dots, and failed exception handling

1 · alex · Jan. 12, 2017, midnight
If you use Spring Boot to set up an endpoint using @RequestMapping with a @PathVariable at the end of the request URI, you might run into several quirks if this path variable happens to include a dot. For example, consider the following mapping: @RequestMapping(value = "/api/resource/{id}", method = RequestMethod.GET) @ResponseBody public Resource getResource(@PathVariable("id") final String id) { final Resource resource = resourceService.findById(id); if (resource == null) { throw new ResourceN...