#StackBounty: #spring-boot #spring-mvc How to get the DispatcherServlet from spring WebApplicationContext?

Bounty: 100

How to get the DispatcherServlet instance from a spring WebApplicationContext object?

I want to perform a direct request to the the front controller servlet (avoiding the network interface) and check the response from a spring application, e.g. WebApplicationContext instance.

Notice, we are not able to use MockMvc to check the HTML rendered by JSP because: "if you use JSPs, you can verify the JSP page to which the request was forwarded, but no HTML is rendered"(according to MockMvc vs End-to-End Tests)

So maybe if we get the DispatcherServlet instance we could perform the request through its doDispatch method and check the content from response.


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.