Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
228 views
in Technique[技术] by (71.8m points)

java - Differences between jar and war in Spring Boot?

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 it.

What are the differences in general?

In jar files the views are under /resources/templates, but in war file it's under /webapp/WEB-INF/.

What are the differences? Can I deploy a jar on an online host?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Spring Boot can be told to produce a 'fat JAR' which includes all of your module/service's dependencies and can be run with java -jar <your jar>. See "Create an executable JAR with Maven" here.

Spring Boot can also be told to produce a WAR file, in which case you'll likely choose to deploy it to a web container such as Tomcat or Jetty.

Plenty more details on Spring Boot deployment here.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

56.9k users

...