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

How to deploy jar package in springboot

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

Share

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

This article mainly introduces "how to deploy the jar package in springboot". In the daily operation, I believe many people have doubts about how to deploy the jar package in springboot. The editor consulted all kinds of materials and sorted out a simple and easy-to-use method of operation. I hope it will be helpful to answer the doubt of "how to deploy the jar package in springboot". Next, please follow the editor to study!

Since war package deployment is commonly used in springboot, when cloud development mode is changed to multi-port, deployment is not accustomed to.

After all, whether the war package wants project name access or not must be placed in the tomcat's root directory

This directory limits the placement of only one item, and the login port is limited to the interface of tomcat.

Therefore, jar package deployment has become an inevitable way.

1. Add pom settings

Static files need to be accessed, so the files under the static file webapp need to be relocated. The specific configuration is as follows

Src/main/webapp META-INF/resources * * /. * false

2. The packing method is changed from war package to jar package.

1. Comment war package mode

Jar

two。 Comment war-plugin

Org.springframework.boot spring-boot-maven-plugin org.supwisdom.Application

3. Comment out spring-boot-starter-tomcat related dependencies

4. Note SpringApplicationBuilder configure in Application.java

/ / @ Override// protected SpringApplicationBuilder configure (SpringApplicationBuilder application) {/ / return application.sources (Application.class); / /} public static void main (String [] args) throws Exception {System.setProperty ("spring.devtools.restart.enabled", "false"); SpringApplication.run (Application.class, args);}

Startup mode:

Cd's current service pom.xml is in the same directory

Mvn clean packagejava-jar target/***.jar

However, there are some problems in actual use, such as during development, the modification of static file code will not react from time to time, and it is useless to clear the browser cache.

Therefore, the cache exists in the jar packaged by springboot, so it is better to comment out the above in the development.

At this point, the study on "how to deploy the jar package in springboot" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

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