spring-boot-2, Serving plain old jsp pages WITHOUT controller?

I’m trying to convert an old legacy application from JavaEE to spring-boot-2.

How do you actually serve plain old JSP-pages WITHOUT a Controller?

I’ve been googling this over and over now, and strange as it sounds, I cannot figure it out or find a simple example that actually WORKS. I just keep getting “404 Not Found” when trying to access the JSP.

I’m using maven, packaging as a WAR file and I’m fine running it as ‘exploded’ (which seems the best bet?), still haven’t been able to make it work.

I don’t understand how this can be so hard, is it no longer POSSIBLE to do this in spring-boot-2?

Anyone can point me to a working example? Or a detailed instruction how to?

EDIT: This is what spring docs say re. JSP Limitations:

“With Jetty and Tomcat, it should work if you use war packaging.” From: https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/

But exactly how? That’s what I’m trying to figure out…


The problem is that Spring Boot by default takes over the world, i.e. it registers the DispatcherServlet with a servlet mapping of /, thereby high-jacking the servlet containers processing of *.jsp files.

To allow the servlet container to process JSPs normally, we need to make sure the Spring DispatcherServlet doesn’t intercept them, e.g. by ensuring that it only handles requests with certain suffixes, or with certain prefixes.

E.g. if no JSP path starts with /api/, then we can use that for the DispatcherServlet, i.e. any request for /api/* will be handled by Spring Boot, and any other request will be handled by the servlet container.

To do that, add the following to the application.properties file:

spring.mvc.servlet.path = /api

Source: stackoverflow