美文网首页
Spring Boot打包 jar和独立部署war

Spring Boot打包 jar和独立部署war

作者: 火星人想回火星 | 来源:发表于2018-04-22 16:46 被阅读0次

一、打包成jar

1.打包 Run As -->Maven build

打成jar

目标jar位于工程的target目录下

2.运行

java -jar demo.jar

3.测试

http://localhost:8080/demo/helloworld

二、打成war

1.增加容器启动入口

增加独立容器部署时的入口

2.更改pom.xml配置

包类型改成war 包依赖方式改变

4.打包

Run As -->Maven build

war位于工程target目录下

5.部署tomcat

启动后测试http://localhost:8080/demo/demo/helloworld

与jar运行差别多了工程名称

参考:https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#getting-started-first-application-run

相关文章

网友评论

      本文标题:Spring Boot打包 jar和独立部署war

      本文链接:https://www.haomeiwen.com/subject/xljclftx.html