【发布时间】:2015-05-20 10:30:09
【问题描述】:
我正在用 spring-boot 做一些实验,我意识到当我使用嵌入式 Tomcat 服务器时,生成的 WAR 大小比我使用 Jetty 甚至具有相同其余依赖项的 Undertow 服务器时要小。
这怎么可能? ... 应该说 Undertow 和 Jetty 与 tomcat 相比应该是超轻量级的。
尺寸为:
Tomcat ~18Mb
Undertow ~21Mb
码头 ~24Mb
它们中的任何一个对我来说都太大了,因为这是虚拟的 REST 端点。 这些是我的依赖项:
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jersey</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!-- <dependency> -->
<!-- <groupId>org.springframework.boot</groupId> -->
<!-- <artifactId>spring-boot-starter-tomcat</artifactId> -->
<!-- </dependency> -->
<!-- <dependency> -->
<!-- <groupId>org.springframework.boot</groupId> -->
<!-- <artifactId>spring-boot-starter-undertow</artifactId> -->
<!-- </dependency> -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
</dependency>
<!-- <dependency> -->
<!-- <groupId>org.springframework.boot</groupId> -->
<!-- <artifactId>spring-boot-starter-test</artifactId> -->
<!-- <scope>test</scope> -->
<!-- </dependency> -->
</dependencies>
【问题讨论】:
-
您是否尝试解压缩 .war 文件并查看 /lib 文件夹以查看额外重量的来源?
标签: java tomcat spring-boot embedded-jetty undertow