Spring Boot - Debug Web MVC application in IDE

With Spring Boot Web MVC application, to debug and identify the unexpected exception thrown from a controller while handling http request, put a debug / break point in the following method of the class. This will quickly reveal the exception along with stacktrace with your favourite IDE

Class: org.springframework.web.servlet.DispatcherServlet
Method: doService

Have a breakpoint in the finally block and evaluate as

request.getAttribute("org.springframework.boot.web.servlet.error.DefaultErrorAttributes.ERROR")

Happy Debugging !!!

Comments

Popular posts from this blog

JSON with curl and jq

Import self signed in Linux for Chrome / Chromium headless testing

Colima - Drop In replacement for Docker Desktop for Mac and Linux