WAR
and JAR
archive startup is quite different, as you can read in this answer.
However, if you use the build-image goal of the spring-boot-maven-plugin
everything gets easier. This plugin creates a hybrid WAR/JAR file, that can be started with:
java -jar name_of_the_file.war
I tested with the version 2.3 of the plugin, but probably it works with earlier 2.x versions. Basically the plugin creates a wrapper that adds the libraries in WEB-INF/lib
and WEB-INF/lib-provided
to your classpath and calls your @SpringBootApplication
class.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…