This happens way too often: you POST or PUT something to a Spring @RestController and Spring only tells you that there is a bad request, HTTP 400 code; no further explanations, no logs, no exceptions.
Spring logs the error cause under the category “org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod"
so you can enable logging for that in your log4j.properties:
log4j.logger.org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod=DEBUG,stdout
[1] Debugging “HTTP 400” errors in Spring annotated MVC controllers
http://fastpicket.com/blog/2012/05/19/debugging-http-400-errors-in-spring-annotated-mvc-controllers/
Thank you very much for this. I was having a hard time figuring out the cause of the 400
LikeLike
This is waaaaay too hard to find. Thanks for sharing, saved me loads of time!
LikeLike