Skip to content
geeksforgeeks
  • Tutorials
    • Python
    • Java
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
    • Practice Coding Problems
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Java Arrays
  • Java Strings
  • Java OOPs
  • Java Collection
  • Java 8 Tutorial
  • Java Multithreading
  • Java Exception Handling
  • Java Programs
  • Java Project
  • Java Collections Interview
  • Java Interview Questions
  • Java MCQs
  • Spring
  • Spring MVC
  • Spring Boot
  • Hibernate
Open In App
Next Article:
Difference Between Spring Boot Starter Web and Spring Boot Starter Tomcat
Next article icon

Difference Between Spring Boot Starter Web and Spring Boot Starter Tomcat

Last Updated : 11 Mar, 2022
Comments
Improve
Suggest changes
Like Article
Like
Report

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.

Next Article
Difference Between Spring Boot Starter Web and Spring Boot Starter Tomcat

D

dudhanevrushali28
Improve
Article Tags :
  • Java
  • Difference Between
  • Java-Spring-Boot
Practice Tags :
  • Java

Similar Reads

    Spring Boot Integration With MongoDB as a Maven Project
    MongoDB is a NoSQL database and it is getting used in software industries a lot because there is no strict schema like RDBMS that needs to be observed. It is a document-based model and less hassle in the structure of the collection. In this article let us see how it gets used with SpringBoot as a Ma
    4 min read
    Spring Boot MockMVC Example
    Automated testing plays a vital role in the software industry. In this article, let us see how to do the testing using MockMvc for a Spring Boot project. To test the web layer, we need MockMvc and by using @AutoConfigureMockMvc, we can write tests that will get injected. SpringBootApplication is an
    3 min read
    Spring Boot Integration With PostgreSQL as a Maven Project
    PostgreSQL is a user-friendly versatile RDBMS. This article lets us see how to integrate Spring Data JPA with PostgreSQL. There are some conventions to be followed while using PostgreSQL. We will cover that also. Working with PostgreSQL We can easily create databases and tables in that. The below sc
    3 min read
    Spring Boot JPA Sample Maven Project With Query Methods
    In this article, let us see a sample maven project in Spring Boot JPA with Query methods. Spring Boot + JPA removes the boilerplate code and it will be enhanced much if we use query methods as well. Let us discuss this project with MySQL Connectivity for geeksforgeeks database and table name as "Con
    6 min read
    Spring Boot - Service Class Example for Displaying Response Codes and Custom Error Codes
    Sometimes the error or status messages in webpages would be different from the default error message thrown by Tomcat (or any other server). An important reason for this is websites want to look unique in their approach to their users. So, a customized page for displaying status codes is always bett
    6 min read
    Spring Boot - Create a Custom Auto-Configuration
    Usually, we might be taking a maven project or grade project for Spring Boot related projects. We will be adding the dependencies in pom.xml (in case of a maven project). In a spring application, Spring Boot auto-configuration helps to automatically configure by checking with the jar dependencies th
    4 min read
    Spring Boot - Consume Message Through Kafka, Save into ElasticSearch, and Plot into Grafana
    In this article, we are going to make a program to produce some data using Kafka Producer which will consume by the Kafka Consumer and save into the elastic search DB, and later on, plot that JSON data into the Grafana dashboard. Start with configuring all the required software and tool. Requirement
    7 min read
    How to Implement AOP in Spring Boot Application?
    AOP(Aspect Oriented Programming) breaks the full program into different smaller units. In numerous situations, we need to log, and audit the details as well as need to pay importance to declarative transactions, security, caching, etc., Let us see the key terminologies of AOP Aspect: It has a set of
    10 min read
    Spring Boot - AOP(Aspect Oriented Programming)
    The Java applications are developed in multiple layers, to increase security, separate business logic, persistence logic, etc. A typical Java application has three layers namely they are Web layer, the Business layer, and the Data layer. Web layer: This layer is used to provide the services to the e
    4 min read
    Spring Boot - Cache Provider
    The Spring Framework provides support for transparently adding caching to an application. The Cache provider gives authorization to programmers to configure cache explicitly in an application. It incorporates various cache providers such as EhCache, Redis, Guava, Caffeine, etc. It keeps frequently a
    6 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences