一、打包成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
网友评论