Java 不同嵌入式服务器的Spring boot WAR大小

Java 不同嵌入式服务器的Spring boot WAR大小,java,tomcat,spring-boot,embedded-jetty,undertow,Java,Tomcat,Spring Boot,Embedded Jetty,Undertow,我正在用spring boot进行som实验,我意识到当我使用嵌入式Tomcat服务器时,产生的WAR规模比我使用Jetty甚至具有相同rest依赖性的Undertow服务器时要小 这怎么可能。。。与tomcat相比,底拖和码头应该是超轻的 尺寸为: Tomcat~18Mb 底拖~21Mb 码头~24Mb 它们中的任何一个对我来说都太大了,因为这是虚拟休息端点。 这些是我的依赖项: <dependencies> <dependency>

我正在用spring boot进行som实验,我意识到当我使用嵌入式Tomcat服务器时,产生的WAR规模比我使用Jetty甚至具有相同rest依赖性的Undertow服务器时要小

这怎么可能。。。与tomcat相比,底拖和码头应该是超轻的

尺寸为:

Tomcat~18Mb

底拖~21Mb

码头~24Mb

它们中的任何一个对我来说都太大了,因为这是虚拟休息端点。 这些是我的依赖项:

    <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>

org.springframework.boot
SpringBootStarterWeb
org.springframework.boot
弹簧启动机tomcat
org.springframework.boot
春靴起跑服
org.springframework.boot
弹簧靴起动器执行器
org.springframework.boot
弹簧靴起动器码头

Spring Boot包括三个示例应用程序,
Spring Boot sample jetty
Spring Boot sample tomcat
,以及
Spring Boot sample undertow
,功能最少,且几乎相同。对于Spring Boot 1.2.2.0版本,存档大小为:

  • 弹簧靴示例码头
    -12MB
  • 弹簧靴示例tomcat
    -9.8MB
  • 弹簧靴样品下拖
    -9.6MB
正如你所看到的,Tomcat和Undertow几乎是一样的,Jetty工件大约大20%


大小差异的一个显著原因是JSP支持。Undertow不支持JSP,Spring Boot默认不包括Tomcat的JSP支持~用于JSP编译的Eclipse Java编译器占用了1.7MB基于Jetty的归档。如果您想使用Jetty而不使用jsp,那么可以排除
org.eclipse.Jetty:Jetty jsp
依赖项。这将基于Jetty的工件的大小减少到8.8MB。

您是否尝试解压缩.war文件并查看/lib文件夹以查看额外的重量来自何处?部署这些嵌入式应用服务器时,这又如何增加应用程序的大小?