Differences between jar and war in Spring Boot?

后端 未结 5 1703
悲哀的现实
悲哀的现实 2020-12-14 07:05

I\'m about to build my first website in Java with Spring Framework using Spring Boot and it\'s much easier to build it in jar, but I have a few questions about

5条回答
  •  自闭症患者
    2020-12-14 07:13

    If you need to deploy it in an external container, you'll normally have to create a war file (which doesn't have to be executable).

    If you want to use the embedded container, you can choose to create an executable .jar file or an executable .war file. AFAIK the only difference is in the layout of the archive, and therefore normally also the layout of your source repository.

    E.g. using standard folder structure with Maven / Gradle, static resources for a .jar will need to be in src/main/resources/static while for a .jar file they should be in src/main/webapp.

提交回复
热议问题