Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to exclude embeded Tomcat in Spring Boot application

Tags:

spring-boot

How can we exclude embedded Tomcat server from Spring Boot application so that we can run that jar on JBoss Server?

like image 697
Deepesh Rathore Avatar asked Dec 15 '17 07:12

Deepesh Rathore


2 Answers

You can exclude in pom file:

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

You can follow this link with screenshots

Spring documentation on Embedded servlet container

like image 51
Yogi Avatar answered Nov 12 '22 22:11

Yogi


you can modify your POM.xml file as follows:

  <!-- 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>
like image 9
aditya gupta Avatar answered Nov 12 '22 22:11

aditya gupta