Skip to main content
Redhat Developers  Logo
  • Products

    Platforms

    • Red Hat Enterprise Linux
      Red Hat Enterprise Linux Icon
    • Red Hat AI
      Red Hat AI
    • Red Hat OpenShift
      Openshift icon
    • Red Hat Ansible Automation Platform
      Ansible icon
    • View All Red Hat Products

    Featured

    • Red Hat build of OpenJDK
    • Red Hat Developer Hub
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat OpenShift Local
    • Red Hat Developer Sandbox

      Try Red Hat products and technologies without setup or configuration fees for 30 days with this shared Openshift and Kubernetes cluster.
    • Try at no cost
  • Technologies

    Featured

    • AI/ML
      AI/ML Icon
    • Linux
      Linux Icon
    • Kubernetes
      Cloud icon
    • Automation
      Automation Icon showing arrows moving in a circle around a gear
    • View All Technologies
    • Programming Languages & Frameworks

      • Java
      • Python
      • JavaScript
    • System Design & Architecture

      • Red Hat architecture and design patterns
      • Microservices
      • Event-Driven Architecture
      • Databases
    • Developer Productivity

      • Developer productivity
      • Developer Tools
      • GitOps
    • Automated Data Processing

      • AI/ML
      • Data Science
      • Apache Kafka on Kubernetes
    • Platform Engineering

      • DevOps
      • DevSecOps
      • Ansible automation for applications and services
    • Secure Development & Architectures

      • Security
      • Secure coding
  • Learn

    Featured

    • Kubernetes & Cloud Native
      Openshift icon
    • Linux
      Rhel icon
    • Automation
      Ansible cloud icon
    • AI/ML
      AI/ML Icon
    • View All Learning Resources

    E-Books

    • GitOps Cookbook
    • Podman in Action
    • Kubernetes Operators
    • The Path to GitOps
    • View All E-books

    Cheat Sheets

    • Linux Commands
    • Bash Commands
    • Git
    • systemd Commands
    • View All Cheat Sheets

    Documentation

    • Product Documentation
    • API Catalog
    • Legacy Documentation
  • Developer Sandbox

    Developer Sandbox

    • Access Red Hat’s products and technologies without setup or configuration, and start developing quicker than ever before with our new, no-cost sandbox environments.
    • Explore Developer Sandbox

    Featured Developer Sandbox activities

    • Get started with your Developer Sandbox
    • OpenShift virtualization and application modernization using the Developer Sandbox
    • Explore all Developer Sandbox activities

    Ready to start developing apps?

    • Try at no cost
  • Blog
  • Events
  • Videos

Putting the “Micro” in Microservices with WildFly Swarm

September 6, 2016
Chris Tozzi
Related topics:
JavaMicroservices
Related products:
Red Hat Data Grid

Share:

    Do you like JavaEE apps, but wonder how to fit them into a microservices-centric workflow? WildFly Swarm is the answer.

    I know—“Java” and “microservices” are not words that seem to go together. Java is an old, relatively unsexy programming language. It’s a pretty useful one, but it was created long before the era of Continuous Delivery, containers and microservices.

    But that doesn’t mean you have to give up on Java if you want to take advantage of microservices. WildFly Swarm makes it easy to split the difference between Java development and microservices deployment by sizing down your JavaEE apps.

    Keep reading for an overview of how WildFly Swarm optimizes JavaEE deployment, and a quick guide to getting started with WildFly Swarm.

    How WildFly Swarm Works

    In September 2016, the most recent version of WildFly Swarm (2016.9), was released. WildFly Swarm builds on the foundation of WildFly, the JavaEE application server formerly known as JBoss, to better facilitate Java EE microservice development.

    Simply put, WildFly Swarm lets you take a JavaEE app and boil it down to only the essential parts necessary to run it as an uber-JAR file. The result is a leaner, meaner way to deploy Java apps.

    If this sounds a bit like unikernels, that’s because it is. But while unikernels in general are a cool idea that has yet to be widely implemented in practice, WildFly Swarm is here and ready for production now.

    Why WildFly Swarm?

    At this point, you may be wondering why you’d want to include a customized application service inside an uber-JAR with your application. After all, it’s not as if traditional Java application servers are the biggest thing taking up space on your infrastructure. And Java deployments via WildFly are already pretty fast.

    That said, why run your Java apps in an application server that has many pieces that aren't used? By cutting out the fat via WildFly Swarm, you get an app and application server combined uber-JAR that sucks up less memory, and is more responsive. Plus, by eliminating unnecessary overhead, they improve security because they reduce your apps’ exposure.

    Packaging as an uber-JAR is a perfect fit for providing a single artifact to be passed through the entire CI/CD pipeline. While also ensuring that what was tested is exactly what's in production, as there are no longer any concerns with differing application server configurations between environments.

    In short, WildFly Swarm lets you fully embrace all the benefits of a microservices-oriented development and deployment workflow. You no longer have to take a monolithic approach to building and running JavaEE apps. Instead, you can compile and deploy just the parts you need, and leave out everything you don’t.

    Setting Up WildFly Swarm

    Excited yet? If not, consider also that deploying WildFly Swarm is pretty trivial if you already have a Java EE project. You just add the wildfly-swarm-plugin to your pom.xml file between plugin tags, like so:

    <plugin>
      <groupId>org.wildfly.swarm</groupId>
      <artifactId>wildfly-swarm-plugin</artifactId>
      <version>${version.wildfly-swarm}</version>
      <executions>
        <execution>
          <phase>package</phase>
          <goals>
            <goal>package</goal>
          </goals>
        </execution>
      </executions>
    </plugin>

    You also need a dependency block like:

    <dependency>
        <groupId>org.wildfly.swarm</groupId>
        <artifactId>jaxrs</artifactId>
        <version>${version.wildfly-swarm}</version>
        <scope>provided</scope>
    </dependency>

    From there, you just build your project. You’ll get a WildFly Swarm-enabled JAR, which will put a traditional application server to shame in terms of leanness and resource optimization.

    For a deeper dive into what WildFly Swarm can do, you can check out examples on GitHub. And complete documentation is available from the WildFly Swarm website.

     

    About Chris

    Screen Shot 2016-08-16 at 1.29.59 PMChris Tozzi has worked as a journalist and Linux systems administrator. He has particular interests in open source, Agile infrastructure and networking. He is Senior Editor of content, and a DevOps Analyst at Fixate IO.

    Last updated: September 25, 2024

    Recent Posts

    • Install Python 3.13 on Red Hat Enterprise Linux from EPEL

    • Zero trust automation on AWS with Ansible and Terraform

    • Cloud bursting with confidential containers on OpenShift

    • Reach native speed with MacOS llama.cpp container inference

    • A deep dive into Apache Kafka's KRaft protocol

    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Platforms

    • Red Hat AI
    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Build

    • Developer Sandbox
    • Developer Tools
    • Interactive Tutorials
    • API Catalog

    Quicklinks

    • Learning Resources
    • E-books
    • Cheat Sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site Status Dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit
    © 2025 Red Hat

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Report a website issue