Over a million developers have joined DZone.

Building Microservices With Wildfly Swarm

DZone's Guide to

Building Microservices With Wildfly Swarm

See how easy it is to build and deploy microservices with lightweight Wildfly Swarm containers.

· Microservices Zone ·
Free Resource

The new Gartner Critical Capabilities report explains how APIs and microservices enable digital leaders to deliver better B2B, open banking and mobile projects.

Wildfly Swarm is a lightweight container for deploying apps and services using various JEE specifications. It supports the full project lifecycle using its own Maven dependency management and build plugin.

For initial development, we are leveraging a JAX-RS based microservice-starter application. More about the lifecycle is explained below.


Wildfly Swarm provides its own Maven support to package the code and it's dependencies as an Uber jar, including the container itself. For this, you need to add the following build plugin.



Wildfly Swarm is an embeddable container that provides support for multiple deployment options. It can deploy web, JAXRS, and EJB containers. You can add a specific fraction for deploying only the required container.



A Wildfly Swarm container can be launched using standard as well as customer launchers.

  • Standard - Just run the following Maven goal on the project.
mvn wildfly-swarm:run
  • Custom - Add an Application class to programmatically invoke and deploy containers.
Swarm swarm = new Swarm();

JAXRSArchive deployment = ShrinkWrap.create(JAXRSArchive.class);

Here we are using the ShrinkWrap API to programmatically create a deployable archive at runtime.

The complete example can found here at microservice-starter-wildflyswarm.

The new Gartner Critical Capabilities for Full Lifecycle API Management report shows how CA Technologies helps digital leaders with their B2B, open banking, and mobile initiatives. Get your copy from CA Technologies.

wildfly swarm ,microservices ,containers ,tutorial

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}