- Support web.xml
spring boot is a great project, but it don't support web.xml. This project support traditional web.xml.
- Support Fat jar
By spring-boot-maven-plugin
, the project can be packaged into an executable jar.
You can also use maven-assembly-plugin/jar-with-dependencies
, but spring-boot-maven-plugin
is a better choice.
- Run in IDE
Run main class io.github.hengyunabc.Main
in your IDE, or
mvn clean package
java -jar target/executable-embeded-tomcat-sample-0.0.1-SNAPSHOT.jar
Open the following link in your browser:
http://localhost:8080/test.jsp
http://localhost:8080/annotation
It is very simple.
-
add embeded tomcat maven dependencies into your pom.xml
-
move
src/main/webapp/WEB-INF
tosrc/main/resources/WEB-INF
, move all files undersrc/main/webapp
tosrc/main/META-INF/resources
.
according to servlet 3.0, ServletContext can get static content from
META-INF/resource
.
- add a main class, start your embeded tomcat.
A sample from oracle, but it do not support web.xml, and do not support run in IDE.
https://github.com/kui/executable-war-sample
Another sample, it has security problems. people can access your .class file through http!!
Apache License V2