Spring Boot with Embedded Tomcat Pros and Cons

Zuul gateway and spring-boot-admin to the rescue

Vinicius Monteiro
Javarevisited

--

Photo by Jason Blackeye on Unsplash

If you work with web services in Java, chances are you work with Spring Boot or at least consider it. (some of the links are affiliate)

When you build your web service using Spring Boot, the default setup is to generate a .jar file. The .jar comes with a web server embedded, and you need to execute it to have the application up and running. The web servers can be Tomcat, Jetty, or Undertow [1]. I’m going to focus on Tomcat.

It’s also possible to use Spring Boot and deploy as a .war file. That’s how I’m more accustomed to it. It feels more natural to me. It’s how I learned — one single Tomcat installation in the server, with multiple applications deployed as .war files.

This article will address the pros and cons of building a Spring Boot application with an embedded Tomcat. It’s the best way (in my view) if you are working with Microservices.

Pros

The pros are not an extensive list, but they are quite significant.

1. Isolation

For me, this is the driving force. Isolation means that the applications are not dependent on a single Tomcat installation. If the embedded Tomcat in service A fails, it…

--

--

Vinicius Monteiro
Javarevisited

Principal Software Developer at Oracle - MySQL Database Service on OCI (views here my own) | https://twitter.com/vinidsmonteiro | vinidsmonteiro@gmail.com