In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces how to deploy springboot's jar package, which is very detailed and has a certain reference value. Friends who are interested must read it!
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
Therefore, it is better to comment out the above in the development.
These are all the contents of the article "how to deploy springboot's jar package". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.