Since # 1 supports Tomcat, why use # 2?
spring-boot-starter-web contains spring-boot-starter-tomcat . spring-boot-starter-tomcat can potentially be used on its own if spring mvc is not required (contained in spring-boot-starter-web ).
Here is the spring-boot-starter-web dependency hierarchy:

What are the differences?
spring-boot-starter-web contains spring web dependencies (including spring-boot-starter-tomcat ):
spring-boot-starter
jackson
spring-core
spring-mvc
spring-boot-starter-tomcat
spring-boot-starter-tomcat contains everything related to the tomcat embedded server:
core
el
logging
websocket
What if you want to use spring mvc without the built-in tomcat server?
Just exclude it from the dependency:
<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>
source share