首页 文章

如何在Spring Boot应用程序中排除嵌入式Tomcat

提问于
浏览
1

我们如何从Spring Boot应用程序中排除嵌入式Tomcat服务器,以便我们可以在JBoss服务器上运行该jar?

2 回答

  • 2

    你可以在pom文件中排除:

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
        <exclusions>
            <exclusion>
                <artifactId>tomcat-embed-el</artifactId>
                <groupId>org.apache.tomcat.embed</groupId>
            </exclusion>
            <exclusion>
                <artifactId>tomcat-embed-core</artifactId>
                <groupId>org.apache.tomcat.embed</groupId>
            </exclusion>
            <exclusion>
                <artifactId>tomcat-embed-websocket</artifactId>
                <groupId>org.apache.tomcat.embed</groupId>
            </exclusion>
        </exclusions>
    </dependency>
    

    您可以通过屏幕截图跟踪此link

    Spring documentation on Embedded servlet container

  • 4

    您可以按如下方式修改POM.xml文件:

    <!-- Removing the dependency for the embedded tomcat -->
                <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>
    

相关问题