The Wayback Machine - https://web.archive.org/web/20240927192742/https://www.geeksforgeeks.org/difference-between-spring-boot-starter-web-and-spring-boot-starter-tomcat/
Open In App

Difference Between Spring Boot Starter Web and Spring Boot Starter Tomcat

Last Updated : 11 Mar, 2022
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

Spring Boot is built on the top of the spring and contains all the features of spring. And is becoming a favorite of developers these days because of its rapid production-ready environment which enables the developers to directly focus on the logic instead of struggling with the configuration and setup. Spring Boot is a microservice-based framework and making a production-ready application in it takes very little time. Following are some of the features of Spring Boot:

  • It allows avoiding heavy configuration of XML which is present in spring
  • It provides easy maintenance and creation of REST endpoints
  • It includes embedded Tomcat-server
  • Deployment is very easy, war and jar files can be easily deployed in the tomcat server

Spring Boot Starter Web

It is mainly used for building web applications that include RESTful applications using Spring MVC. It uses Tomcat as the default embedded container. It has two important features:

  • It is compatible with web development.
  • It can be auto-configured.

We need to add the following dependency in the pom.xml file for Spring Boot Starter Web:

XML




<dependency>  
  <groupId>org.springframework.boot</groupId>  
  <artifactId>spring-boot-starter-web</artifactId>  
  <version>2.2.2.RELEASE</version>  
</dependency>


It uses Spring MVC, REST, and Tomcat as a default embedded server. The single spring-boot-starter-web dependency can pull in all dependencies related to web development. It also reduces the count of build dependency. The spring-boot-starter-web mainly depends on the following:

  • org.springframework.boot:spring-boot-starter
  • org.springframework.boot:spring-boot-starter-tomcat
  • org.springframework.boot:spring-boot-starter-validation
  • com.fasterxml.jackson.core:jackson-databind
  • org.springframework:spring-web
  • org.springframework:spring-webmvc

By default, the spring-boot-starter-web contains the below tomcat server dependency given:

XML




<dependency>  
  <groupId>org.springframework.boot</groupId>  
  <artifactId>spring-boot-starter-tomcat</artifactId>  
  <version>2.0.0.RELEASE</version>  
  <scope>compile</scope>  
</dependency>


The spring-boot-starter-web auto-configures the below things required for the web development:

  • Dispatcher Servlet
  • Error Page
  • Embedded servlet container
  • Web JARs for managing the static dependencies

Spring Boot also supports Jetty Server and Undertow Server. They are embedded web servers. We can also exclude spring-boot-starter-tomcat from spring-boot-starter-web as follows:

XML




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


Spring Boot Starter Tomcat

While the spring-boot-starter-tomcat has everything related to the Tomcat server. It has

  • core
  • el
  • logging
  • WebSocket

It has the below dependencies

XML




<dependency>  
  <groupId>org.apache.tomcat.embed</groupId>  
  <artifactId>tomcat-embed-core</artifactId>  
  <version>8.5.23</version>  
  <scope>compile</scope>  
</dependency>  
<dependency>  
  <groupId>org.apache.tomcat.embed</groupId>  
  <artifactId>tomcat-embed-el</artifactId>  
  <version>8.5.23</version>  
  <scope>compile</scope>  
</dependency>  
  <dependency>  
  <groupId>org.apache.tomcat.embed</groupId>  
  <artifactId>tomcat-embed-websocket</artifactId>  
  <version>8.5.23</version>  
  <scope>compile</scope>  
</dependency>


Difference Between Spring Boot Starter Web and Spring Boot Starter Tomcat

Spring Boot Starter Web

Spring Boot Starter Tomcat

Spring Boot Starter Web is used for building RESTful applications using Spring MVC. Spring Boot Starter Tomcat is the default embedded container for Spring Boot Starter Web. 
We cannot exclude it while using web services. We can exclude it when we want to use another embedded container.
It also supports Jetty Server and Undertow Server. It acts as an embedded web server.
It auto-configures Dispatcher Servlet, Error Page, Embedded servlet container, and Web JARs for managing the static dependencies for web development. It has a core, el. logging, WebSocket.
It contains spring web dependencies. It contains everything related to an embedded tomcat server.
It auto-configures the features used for web development. It is used as the default embedded container.


Previous Article
Next Article

Similar Reads

Spring Boot - Customizing Spring Boot Starter
Spring Boot Starters are specialized project types designed to encapsulate and distribute common functionality, simplifying the setup of Spring Boot applications. Official starters, like spring-boot-starter-web and spring-boot-starter-data-jpa, bundle dependencies, configurations, and pre-built beans for specific use cases. Creating a custom Spring
6 min read
Spring Boot - Starter Web
Today most of the applications demand Model-View-Controller (MVC) architecture to meet the various needs like handling user data, making application efficient, to provide dynamic nature to applications. It was basically used for building desktop graphical user interfaces (GUIs), but now is becoming more popular for building web-based applications.
6 min read
Spring Boot - Project Deployment Using Tomcat
Spring Boot is a microservice-based framework and making a production-ready application in it takes very little time. Spring Boot is built on the top of the spring and contains all the features of spring. And is becoming a favorite of developers these days because it’s a rapid production-ready environment that enables the developers to directly foc
5 min read
Configuring a Tomcat Connection Pool in Spring Boot
The Spring Boot is a powerful layer of abstraction placed on the Spring platform. It makes developing standalone and production-ready web applications easy. Spring Boot provides a few starter dependencies for handling the application. In this article, we discuss configuring a Tomcat Connection Pool in Spring Boot. We can use any database for this p
3 min read
Difference between Apache Tomcat server and Apache web server
Apache Tomcat server: Apache Tomcat is a web container. It allows the users to run Servlet and JAVA Server Pages that are based on the web-applications. It can be used as the HTTP server. The performance of the Tomcat server is not as good as the designated web server. It can be used as separate product with its own internal Web-server. It can also
2 min read
Spring Boot - Starter Parent
Spring Boot Starter Parent is a starter project that provides the default configuration for spring-based applications. It is added as a parent in the pom.xml file. The spring-boot-starter-parent defines spring-boot-dependencies as its parent. The spring-boot-starter-parent inherits dependency management from spring-boot-dependencies. Every Spring B
3 min read
Spring Boot - Starter Test
Spring Boot is built on the top of the spring and contains all the features of spring. And is becoming a favorite of developers these days because of its rapid production-ready environment which enables the developers to directly focus on the logic instead of struggling with the configuration and setup. Spring Boot is a microservice-based framework
4 min read
Spring Boot 3 - Creating a Custom Starter
Starters are an integral part of the Spring Boot application. In addition to dependency versioning, they provide the ability to describe the configuration for a particular functionality. They gained their popularity due to the development of microservice architecture. When we have dozens or hundreds of services within one application, some of the f
3 min read
Deployment of Spring MVC Application on a Local Tomcat Server
Spring MVC is a Web Framework under the group of projects by Spring Team using Java EE technologies. ïŧŋIt is an open source and fairly used to create robust and dependable web applications with Java Programming Language. Spring MVC is designed across the Model-View-Controller (MVC) Architecture. To run the Spring MVC web application, we want to inst
4 min read
Spring Boot – Handling Background Tasks with Spring Boot
Efficiently handling background tasks with Spring Boot is important for providing a smooth user experience and optimizing resource utilization. Background tasks refer to operations that are performed asynchronously or in the background, allowing the main application to continue processing other requests. In a Spring Boot application, background tas
5 min read
Spring Boot – Using Spring Boot with Apache Camel
Apache Camel and Spring Boot are two powerful frameworks that can be seamlessly integrated to build robust, scalable, and efficient applications. Apache Camel is an open-source integration framework that provides an extensive range of components and connectors, enabling developers to integrate different systems, APIs, and applications. It simplifie
5 min read
Spring Boot – Setting Up a Spring Boot Project with Gradle
Spring Boot is a Java framework designed to simplify the development of stand-alone, production-ready Spring applications with minimal setup and configuration. It simplifies the setup and development of new Spring applications, reducing boilerplate code. In this article, we will guide you through setting up a Spring Boot project using Gradle, a wid
4 min read
Migrate Application From Spring Boot 2 to Spring Boot 3
With the release of Spring Boot 3, significant changes and improvements have been introduced, particularly around Jakarta EE compliance, Java 17 support, and GraalVM native images. If you are using Spring Boot 2 and are considering migrating to Spring Boot 3, this article will walk you through the necessary steps, considerations, and potential pitf
5 min read
Spring Boot - Spring JDBC vs Spring Data JDBC
Spring JDBC Spring can perform JDBC operations by having connectivity with any one of jars of RDBMS like MySQL, Oracle, or SQL Server, etc., For example, if we are connecting with MySQL, then we need to connect "mysql-connector-java". Let us see how a pom.xml file of a maven project looks like. C/C++ Code <?xml version="1.0" encoding=
4 min read
Spring vs Spring Boot vs Spring MVC
Are you ready to dive into the exciting world of Java development? Whether you're a seasoned pro or just starting out, this article is your gateway to mastering the top frameworks and technologies in Java development. We'll explore the Spring framework, known for its versatility and lightweight nature, making it perfect for enterprise-level softwar
8 min read
Difference between Spring MVC and Spring Boot
1. Spring MVC : Spring is widely used for creating scalable applications. For web applications Spring provides Spring MVC framework which is a widely used module of spring which is used to create scalable web applications. Spring MVC framework enables the separation of modules namely Model View, Controller, and seamlessly handles the application in
3 min read
Difference between Spring and Spring Boot
Spring Spring is an open-source lightweight framework that allows Java developers to build simple, reliable, and scalable enterprise applications. This framework mainly focuses on providing various ways to help you manage your business objects. It made the development of Web applications much easier compared to classic Java frameworks and Applicati
4 min read
Difference between Web Content, Web Structure, and Web Usage Mining
Web mining is an application of the Data Mining technique that is used to find information patterns from the web data. Web Mining helps to improve the power of web search engines by identifying the web pages and classifying web documents. Types of Web Mining : 1. Web Content Mining - Web Content Mining can be used for the mining of useful data, inf
2 min read
Difference Between Web 1.0, Web 2.0, and Web 3.0
Web 1.0 was all about fetching, and reading information. Web 2.0 is all about reading, writing, creating, and interacting with the end user. It was famously called the participative social web. Web 3.0 is the third generation of the World Wide Web, and is a vision of a decentralized web which is currently a work in progress. It is all about reading
8 min read
Configuration of Apache Tomcat Server with Eclipse IDE
In this article, we will discuss a step by step guide to setup Apache Tomcat server in Eclipse IDE. Eclipse IDE: Eclipse is an open-source Integrated Development Environment that is popular for Java application development (Java SE and Java EE) and Android apps. It also supports C/C++, PHP, Python, Perl, and other web project developments via exten
2 min read
Creating JSP in Eclipse IDE with Tomcat Server
Eclipse IDE is an open-source Integrated Development Environment that is popular for Java application development (Java SE and Java EE) and Android apps. It also supports C/C++, PHP, Python, Perl, and other web project developments via extensible plug-ins. JSP stands for java server pages. It is a server side technology been used for creating web a
3 min read
Setup Apache Tomcat Server in IntelliJ IDE for Java J2EE Development Projects
In this article, we will discuss a step-by-step guide to set up Apache Tomcat server in IntelliJ IDE. IntelliJ IDEA is an intelligent, context-aware IDE for working with Java and other JVM languages like Kotlin, Scala, and Groovy on all sorts of applications and other web project development. For this IDE we need to add the server externally so tha
3 min read
How to Run Servlet in Tomcat?
In this example, we will create a basic servlet that displays a Hello World message from a Java program to the user in the browser without using any Java IDE like Eclipse. Note: Running a server like Tomcat to run our servlet. if it is not already installed, you can install it using this article: How to Install Apache Tomcat on Windows? Basic Terms
3 min read
Difference Between Spring DAO vs Spring ORM vs Spring JDBC
The Spring Framework is an application framework and inversion of control container for the Java platform. The framework's core features can be used by any Java application, but there are extensions for building web applications on top of the Java EE platform. Spring-DAO Spring-DAO is not a spring module. It does not provide interfaces or templates
5 min read
How to Create a Spring Boot Project in Spring Initializr and Run it in IntelliJ IDEA?
Java language is one of the most popular languages among all programming languages. There are several advantages of using the java programming language, whether for security purposes or building large distribution projects. One of the advantages of using Java is that it tries to connect every concept in the language to the real world with the help
3 min read
How to Create and Setup Spring Boot Project in Spring Tool Suite?
Spring Boot is built on the top of the spring and contains all the features of spring. And is becoming a favorite of developers these days because of its rapid production-ready environment which enables the developers to directly focus on the logic instead of struggling with the configuration and setup. Spring Boot is a microservice-based framework
3 min read
How to Make a Project Using Spring Boot, MySQL, Spring Data JPA, and Maven?
For the sample project, below mentioned tools got used Java 8Eclipse IDE for developmentHibernate ORM, Spring framework with Spring Data JPAMySQL database, MySQL Connector Java as JDBC driver.Example Project Using Spring Boot, MySQL, Spring Data JPA, and Maven Project Structure: As this is getting prepared as a maven project, all dependencies are s
4 min read
Java Spring Boot Microservices – Integration of Eureka and Spring Cloud Gateway
Microservices are small, loosely coupled distributed services. Microservices architecture evolved as a solution to the scalability, independently deployable, and innovation challenges with Monolithic Architecture. It provides us to take a big application and break it into efficiently manageable small components with some specified responsibilities.
5 min read
What's New in Spring 6 and Spring Boot 3?
Spring and Spring Boot are two of the most popular Java frameworks used by developers worldwide. The Spring team is continuously working on improving and enhancing the frameworks with each new major release. Spring 6 and Spring Boot 3 are expected to bring in significant new features and changes that will further boost development with these techno
5 min read
How to Integrate Keycloak with Spring Boot and Spring Security?
Keycloak is Open Source Identity and Access Management (IAM) solution developed by Red Hat. By using this you can add authentication to applications and secure services with minimum effort. No need to deal with storing users or authenticating users. Keycloak provides user federation, strong authentication, user management, fine-grained authorizatio
2 min read
Practice Tags :