Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are several deployment methods of SpringBoot?

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article shows you what the deployment of SpringBoot is like, the content is concise and easy to understand, it will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.

Deploy as a stand-alone application in Java Archive (JAR)

Spring Boot applications can be easily packaged into JAR files and deployed as stand-alone applications. This is done by spring-boot-maven-plugin. Once the Spring project is created as a Maven project through Spring Initializr, the plug-in is automatically added to the pom.xml.

Org.springframework.boot spring-boot-maven-plugin

To package the application in a single (fat) jar file, mvn package runs the maven command in the project directory. This packages the application into an executable jar file that contains all the dependencies (including the embedded servlet container-if it is a Web application). To run the jar file, use the following standard JVM command:

Java-jar .jar

Deploy the Web Application Archive (WAR) to the servlet container

Spring Boot applications can be packaged into WAR files for deployment into existing servlet containers such as Tomcat,Jetty, and so on. This can be done as follows:

Specify the WAR package war through the pom.xml file. This packages the application as a WAR file (instead of JAR). In the second step, set the scope of the Tomcat (servlet container) dependency to provided (so that it is not deployed to the WAR file):

Org.springframework.boot spring-boot-starter-tomcat

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report