Spring Boot package web application to .jar -


why spring boot default packaging web applications .jar ? there advantages on .war ?

shouldn't web applications packed .war in order deployed real web server ?

i thought .jar files desktop applications whereas .war files web applications. since .jar doesn't contain web application components mentioned here:

java war vs. jar - difference?

you linked question war vs jar, while spring boot's jar indeed jar, contains more put inside jar. spring boot comes embedded servlet container, inside the jar itself.

so difference:

  • a jar: contains resources/libraries/desktop applications/...
  • a war: web application can run on web container
  • the spring boot fat jar: web application runs on own web container

about question:

shouldn't web applications packed .war in order deployed real web server?

if want run web application on existing servlet container, have use war file. spring boot jar comes own servlet container, can run well.

which of 2 choose own choice. though josh long's mantra "make jar, not war".


Comments