For example,
I understand adding specific dependencies like spring-boot-starter-web
that contains tomcat as transitive dependency triggers the spring framework to initialize tomcat
container but I want to know if we say a spring-boot
application is running, does it imply always that tomcat is also running?

- 27
- 8
-
3Does this answer your question? [Spring Boot without the web server](https://stackoverflow.com/questions/26105061/spring-boot-without-the-web-server) – Meninx - メネンックス Sep 12 '21 at 13:52
-
1Could be Netty; need not always be Tomcat. – duffymo Sep 12 '21 at 14:43
-
Thank you @Meninx-メネンックス, This helped me to understand how to disable the server but I also wanted to know if tomcat runs (always) whenever we run a spring-boot application. From provided answers below, I now understand it is not the case. – PolamreddyVivekReddy Sep 13 '21 at 04:49
-
@PolamreddyVivekReddy no problem ! – Meninx - メネンックス Sep 13 '21 at 09:09
2 Answers
I want to know if we say a spring-boot application is running, does it imply always that tomcat is also running?
No, it doesn't.
Spring boot can be used for both web applications and non-web applications. For web applications you can use tomcat/jetty/undertow/netty for example, its up to you to chose what works for you the best.
If you don't want to run an embedded version of the web server you can opt for creating a WAR file and place it into the web server prepared in-advance.
If you don't want to run web application at all (something that is built around "Request - Response" way of work in the most broad sense) - you can create a "CommandLineRunner" - in this case you don't need to depend on neither web-mvc nor webflux. For more information about Command Line Runners read here for example

- 39,963
- 4
- 57
- 97
You can have an embedded server in your JAR that is able to be run on its own. By default it is Tomcat but you can change this to others, like Jetty. Additional details:
- https://docs.spring.io/spring-boot/docs/2.0.6.RELEASE/reference/html/howto-embedded-web-servers.html
If you don't want to have an embedded server and you want to deploy your application you can also create WAR files instead of JAR files. Additional details:

- 16,277
- 6
- 33
- 45