Spring Boot打包 jar和独立部署war

2018-04-22  本文已影响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

上一篇 下一篇

猜你喜欢

热点阅读