Problem Statement:
With Spring Boot Auto Embedded Tomcat Configuration, JSP's are not rendering on Browser
With the above configuration, there was no error on console/logs. But still my JSP's were not reendering on browser.
So with some analysis, i tried making some changes to above configuration as below (adding @EnableWebMvc annotation)
After adding above annotation, still JSP's were not rendering on browser. But, this time i saw error on console/logs
"No mapping found for HTTP request with URI".
Now I tried overriding the DefaultServletHandling() method from WebMvcConfigurerAdapter.java as below
Now after this change, my JSP's were SUCCESSFULLY started rendering on browser.
BUT QUESTION STILL STANDS,
"WHY I HAVE TO MAKE THIS CONFIGURATION (HARD CODE DEPENDENCY ON WebMvcConfigureAdapter ) WITH SPRING-BOOT" ?????????
I did more analysis and found that i can avoid this hardcoding by configuring my POM.xml because there were dependencies missing in the Embedded Tomcat required to parse/render the JSP/JSTL content on browser.
So i configured my POM.xml with last two dependencies (JASPER & JSTL) as below :
And now my Configuration Code (after commenting the hard code for rendering JSP's), looks like:
That's IT........... ENJOY :)