-
Notifications
You must be signed in to change notification settings - Fork 41.5k
Description
I would like to migrate some ancient multi module spring application containing lots of JSPs to spring-boot.
I know https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#boot-features-jsp-limitations but some preceding (single module) tests all ran fine.
Since I would like to preserve the multi module structure, I first ran into a problem, which fortunately has been solved here: #3436
So, I can start my multi module project with the usual mvn spring-boot:run
but unfortunately JSPs can not be served this way!
I created a simple example project https://github.com/drahkrub/spring-boot-multi-module-jsp (a simplified version of https://github.com/spring-projects/spring-boot/tree/v2.1.4.RELEASE/spring-boot-samples/spring-boot-sample-tomcat-jsp turned into a multi module project) with the following minimalistic content:
.
├── pom.xml
└── webapp
├── pom.xml
└── src
└── main
├── java
│ └── de
│ └── idon
│ └── sandbox
│ ├── SandboxJspApplication.java
│ └── WelcomeController.java
├── resources
│ └── application.properties
└── webapp
└── WEB-INF
└── jsp
└── welcome.jsp
Now, if started with mvn spring-boot:run
(or mvn -pl webapp -am spring-boot:run
) http://localhost:8080/ gives
There was an unexpected error (type=Not Found, status=404).
/WEB-INF/jsp/welcome.jsp
But if running the WAR file, i.e. mvn clean package
followed by
java -jar webapp/target/spring-boot-multi-module-jsp-webapp-0.0.1-SNAPSHOT.war
http://localhost:8080 works as expected.
I noticed that mvn spring-boot:run
also works if the content of webapp/src/main/webapp
is copied in a folder src/main/webapp
in the parent module (obviously the place expected by the spring-boot maven plugin if operating in single module mode).
Is there a clean solution for this problem?
I tried some of the parameters described here but maybe I've used them incorrectly or tried the wrong ones... ;-)