Spring Boot with Embedded Tomcat Pros and Cons

Spring Boot with Embedded Tomcat Pros and Cons

Spring Boot with Embedded Tomcat Pros and Cons. When you build your web service using Spring Boot, the default setup is to generate a .jar file. The .jar - The web servers can be Tomcat, Jetty, or Undertow [1]. I’m going to focus on Tomcat.

Zuul gateway and spring-boot-admin to the rescue

If you work with web services in Java, chances are you work with Spring Boot as well or at least is considering it.

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

In this article, I’m going to 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 won’t impact service B or C as each one has its own  Tomcat. Unless the services call each other (which it shouldn’t )— but that’s a different problem. With one single Tomcat, with services calling each other or not, if the Tomcat is shut down, all services are impacted.

Such isolation also means that using Docker may be overkill (don’t beat me just yet). I’ve never used Docker, to be honest, I don’t feel comfortable elaborating too much on this argument. I’m pretty sure it provides many benefits. Based on what I’ve read, it involves much more than just building an application with embedded Tomcat.

java microservices tomcat spring-boot

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

How to Use Spring Boot and JHipster With Reactive Java Microservices

Learn how to use Spring Boot and JHipster With Reactive Java Microservices. Create a reactive microservices architecture with Spring Boot, Spring Cloud Gateway, Spring Cloud Config, Spring WebFlux, Java, and JHipster.

10 Best Java Microservices Courses With Spring Boot and Spring Cloud

In the Java world, Spring provides several tools and frameworks to develop microservices, like Spring Boot and Spring Cloud, and in this article, I’ll share a few good courses you can use to learn how to develop microservices using the Spring framework.

Top 10 Advanced Java and Spring Boot Courses for Full-Stack Java Developers

These are best online courses to learn Spring Boot, Advanced Java, Docker, React, Microservices, DEvops, and Angular to become full stack Java developer.

Microservices Spring Boot | Microservices Full Course | Microservices Tutorial

In this video you will learn the different types of service discoveries implementations using Netflix Eureka Server, Hashicorp Consul and Apache Zookeeper an...

Reactive Java Microservices with Spring Boot and JHipster

Learn how to create a Reactive Java Microservices Architecture using Spring Boot and JHipster. Spring Boot 2.0 introduced a new web framework called Spring WebFlux. WebFlux offers a way for developers to do reactive programming. Java has been at the forefront of microservice architectures since they came to prominence a few years ago. It’s a popular language with well-known, high-quality frameworks, like Spring Boot, Spring Cloud, Spring Data, and Spring Security.