Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert a Spring application WAR to stand-alone JAR?

I have a WAR with Java Spring application, which I can deploy to a Java application server. I need to run it on a machine with JRE, but without application server, i.e. with java -jar my_application.jar.

The guide "Convert an existing application to Spring Boot" is a close match, except that I do not need to create a deployable WAR as I already have it. The existing code does not use @SpringBootApplication, and I'd prefer not to mangle with it.

like image 554
Konstantin Shemyak Avatar asked Oct 29 '22 14:10

Konstantin Shemyak


1 Answers

If you want a runnable 'Jar' file, then the jar file must contain the Web server, so you best option is to convert your application to spring boot. Spring boot is able to package an application as a war file, so it can be deployed on a Tomcat, or be launched with java -jar, but it has to be a spring boot app to begin with.

like image 98
Klaus Groenbaek Avatar answered Nov 01 '22 04:11

Klaus Groenbaek