简体   繁体   中英

Confiusion with .jar file and spring boot

I am a bit confused , why my application is working. I have my spring boot project which compiles into .jar

<groupId>Twitter</groupId>
    <artifactId>twitter-api</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

and the application working fine (it's simple web app). Thing I'm missing here is, why it is working while <packaging> is set to .jar and not .war (as for web app). I mean to use it "normally" I'd put the .war file into webapp folder (talking about tomcat), and then access it xxxx/myapp. But here Im packaging it into .jar and it's working as webapp. Could someone explain me this? Thanks in advance folks!

Tomcat is running inside the JAR. Spring Boot can run as an executable JAR without a Java EE app server or servlet/JSP engine.

Normally Spring Boot embedd a servlet engine into your JAR and start your Application within this embedded servlet engine (Jetty, Tomcat). Have a look at the Spring Boot Project .

This features are called

  • Create stand-alone Spring applications
  • Embed Tomcat, Jetty or Undertow directly (no need to deploy WAR files)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM