DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Last call! Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • Component Tests for Spring Cloud Microservices
  • Configuring Java Apps With Kubernetes ConfigMaps and Helm
  • Advanced Functional Testing in Spring Boot Using Docker in Tests
  • Building Mancala Game in Microservices Using Spring Boot (Part 3: Web Client Microservice Implementation Using Vaadin)

Trending

  • Apache Doris vs Elasticsearch: An In-Depth Comparative Analysis
  • The Cypress Edge: Next-Level Testing Strategies for React Developers
  • While Performing Dependency Selection, I Avoid the Loss Of Sleep From Node.js Libraries' Dangers
  • A Guide to Container Runtimes
  1. DZone
  2. Testing, Deployment, and Maintenance
  3. Deployment
  4. Building Microservices With[out] Spring Boot

Building Microservices With[out] Spring Boot

Spring Boot has made building microservices almost effortless, but you can use other tools to achieve the same result. Read on to learn how.

By 
Vinod Pahuja user avatar
Vinod Pahuja
·
Jun. 01, 18 · Tutorial
Likes (11)
Comment
Save
Tweet
Share
26.9K Views

Join the DZone community and get the full member experience.

Join For Free

Microservices...microservices everywhere.

Everyone is talking about microservices and tools and framework to build them. One common name you may have heard of is Spring Boot. It has made creating microservices so quick and easy that even a novice developer can build one in few minutes. 

Apart from development and monitoring, a microservice consists of the following phases:

  • Packaging
  • Deployment
  • Launcher

Let's first discuss all these in details with regards to Spring Boot.

Spring Boot

Spring Boot provides out-of-the-box support for all these phases, with dedicated components in the form of plugins and modules. 

Packaging - It provides its own Maven support to package the code and all dependencies as an Uber jar, including the container itself. For this, you need to add the following build plugin and a simple repackage goal that repackages the binary built during the normal Maven package phase.

Deployment - It comes with a different type of web container to support the embedded deployment of web resources like servlets/JSP. On top of that, it provides a Jersey container that can deploy RESTful resources.

Launcher - Spring Boot has made launching an application as easy as running the Hello World program. Only one line of code triggers the dependency management, package scan, and container initialization.

Reference Code: microservice-starter-springboot

After looking into all these aspects, these artefacts could be made using different tools and frameworks. Let discuss eachweb server and platform. 

Tomcat

Tomcat is generally used as web container for deploying web applications, but it can also be used as an embedded container for running packaged microservices. For this, it requires the things below to make a contained microservice.

Packaging - Unlike Spring Boot, it does not provide an out-of-the-box solution for packaging your microservice, but you can use a Maven standard plugin like assemble and shade to build an Uber jar that contains all the dependencies and supports main class manifests.

Deployment - All the Tomcat runtime modules can be provided with a single dependency that can deploy and run the Jersey container.

Launcher - Tomcat allows you to configure your endpoint and container programmatically, and you can start and stop the instance within your control.

Reference Code: microservice-starter-tomcat

Jetty

Jetty is a perfect fit for deploying and running microservices as it mostly uses an embedded container for running web applications. It also follows the same pattern as Tomcat to run microservices.

Packaging - It can utilize Maven standard plugins to package your code and dependencies in a single Uber jar.

Deployment - Jetty provide a servlet container that can be topped up by a Jersey container to serve web services.

Launcher - Like Tomcat, it provides a similar programmatic API to deploy Jersey containers and REST endpoints.

Reference Code: microservice-starter-jetty

Grizzly

Grizzly is a less popular web container, but it powers the most standard application server for the JEE community. Yes, it's the engine behind the Glassfish server. It does provide out-of-the-box features for building microservices.

Packaging - We can use a Maven standard plugin like assembly and shade for packaging the web service and its dependencies.

Deployment - Unlike Tomcat and Jetty, it provides built-in support for deploying web services built using Jersey and provides standard container-based Grizzly HTTP services.

Launcher - Like Spring Boot, it provides a very abstract API for configuring REST services and running the container itself within a single line of code.

Reference Code: microservice-starter-grizzly

Netty

Netty is a well-known async and event-driven client/server framework that supports the majority of protocols like FTP, SMTP, and HTTP and provides low-level programming for UDP and TCP applications. On top of that, Glassfish provides a special Jersey container that uses non-blocking IO and HTTP services. It can be used as a web service container in a similar fashion to Grizzly.

Packaging - We can use a Maven standard plugin like assembly and shade for packaging the web service and its dependencies.

Deployment - Like Grizzly, it provides out-of-the-box support for deploying web services built using Jersey and provides a standard container based on Netty HTTP services.

Launcher - Like Grizzly, it provides a very abstract API for configuring REST services and running the container.

Reference Code: microservice-starter-netty

Undertow

Undertow is a web server that powers the popular JBoss AS and is able to run as an embedded container. It provides granular HTTP and non-blocking IO services. On top of that, it provides Servlet and Web Socket implementations. It can be used for building microservices in a similar fashion.

Packaging - We can use a Maven standard plugin like assembly and shade for packaging the web service and its dependencies.

Deployment - Undertow provides an HTTP Servlet container that can be used with a Jersey Servlet container.

Launcher - It also provides a programmatic API to deploy the Jersey container and REST endpoints.

Reference Code: microservice-starter-undertow

Conclusion

Now we have seen that Spring Boot is good for microservices, but you can build one with basic tool and frameworks. Also starting up is not too difficult as shown in these starter code references.

Spring Framework microservice Spring Boot Web Service Container

Opinions expressed by DZone contributors are their own.

Related

  • Component Tests for Spring Cloud Microservices
  • Configuring Java Apps With Kubernetes ConfigMaps and Helm
  • Advanced Functional Testing in Spring Boot Using Docker in Tests
  • Building Mancala Game in Microservices Using Spring Boot (Part 3: Web Client Microservice Implementation Using Vaadin)

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!