关于springboot项目的jar和war两种打包方式部署的区别

关于springboot项目的jar和war两种打包方式部署的区别

关于springboot项目的jar和war两种打包方式部署的区别?

https://bbs.csdn.net/topics/392493467

 

1.我的一个springboot项目,用mvn install打包成jar,换一台有jdk的机器就直接可以用java -jar 项目名.jar的方式运行,没任何问题,为什么这里不需要tomcat也可以运行了?

 

<dependency>

    <groupId>org.springframework.boot</groupId>

    <artifactId>spring-boot-starter-web</artifactId>

</dependency>

 

依赖下面这个:

<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-tomcat -->

<dependency>

    <groupId>org.springframework.boot</groupId>

    <artifactId>spring-boot-starter-tomcat</artifactId>

    <version>2.1.6.RELEASE</version>

</dependency>

 

这个又依赖下面这几个:

Apache 2.0 org.apache.tomcat.embed » tomcat-embed-core

 

Apache 2.0 org.apache.tomcat.embed » tomcat-embed-el

 

Apache 2.0 org.apache.tomcat.embed » tomcat-embed-websocket

 

所有 最终 还是有依赖tomcat的,只不过是内置的

 

要是打war包,是要排除内置的tomcat的

 

 

 

spring boot 打成jar包的时候,你可以看一下pom文件,在pom里面有一些tomcat的jar包引用,就是Spring boot内置的tomcat,

打war包时,需要注释掉这些tomcat的引用

转载于:https://www.cnblogs.com/feng9exe/p/11401768.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值