I'm trying to migrate from Spring Boot 1.5.7 to 2.0.0.M4
This is my rest controller:
@RestController
@RequestMapping("/v1.0/users")
public class UsersController {
@Autowired
private UserService userService;
@RequestMapping(value = "/validate-username/{username}", method = RequestMethod.GET)
@ResponseStatus(value = HttpStatus.OK)
public void validateUsername(@PathVariable String username) {
throw new EntityAlreadyExistsException();
}
...
}
This is exception handler:
@ControllerAdvice
public class GlobalControllerExceptionHandler {
@ExceptionHandler
@ResponseBody
@ResponseStatus(HttpStatus.CONFLICT)
public Map<String, ResponseError> handleEntityAlreadyExistsException(EntityAlreadyExistsException e, HttpServletRequest request, HttpServletResponse response) throws IOException {
logger.debug("API error", e);
return createResponseError(HttpStatus.CONFLICT.value(), e.getMessage());
}
}
in case of the following username, for example : alex everything is working fine and I'm receiving 409 status code with application/json; charset=UTF-8 as a content type but in case of the following user name, for example, alex@test.com my endpoint returns 500 status code and non-JSON content type, something like this:
I can reproduce this issue when username PathVariable contains .com at the end.
I use embedded Tomcat as tbe application server. Woth Spring Boot 1.5.7 the same functionality was working fine. How to make it working with Spring Boot 2.0.0.M4 ?
P.S.
I know that sending email addresses as URL parameter is a bad practice. I'm just interested in this particular case.
