How to deploy a Spring Boot WAR in Wildfly / JBoss

This is a short guide on how to deploy a war packaged Spring Boot application in Wildfly. As you know Wildfly is the new name for JBoss AS since 8.0 version, so this configuration should work in JBoss as well.

Spring Boot guys encourage you to deploy your application in the embedded Tomcat server when you package the jar file. That is really powerful but sometimes you need to deploy your application in an existing application server such as Wildfly or JBoss, and for that, you need a deployable WAR file.

In order to make everything work, you will have to follow some easy steps.

  1. First, go to your application main class and make it extends SpringBootServletInitializer.
  2. Override the configure method and specify your Spring application sources that should be configured by SpringApplicationBuilder. If you don’t do that, your different components won’t be detected and your application won’t work.
  3. Now you should write some additional configuration in your Maven pom.xml file. Apart from the obvious part about changing the packaging method to war, you will exclude now the embedded tomcat server and specify a provided dependency with the javax.servlet API.
  4. As you can see above you can even remove the spring-boot-maven-plugin plugin , since you don’t need it when deploying in the external server. This will save you some extra megabytes in the WAR file.

Did you find it useful? If you want to read more:

  • Interested in Spring Boot and Microservices? Are you looking for practical how-to guides to go from scratch to production? You can get my book and start learning today: Microservices –
    The Practical Way
  • Check out my Spring Boot project for a simple gamification app.
  • Do you want to know more about this gamification project? Read my article about it.

Related Posts

A practical book about Microservices Microservices are getting very popular these days. This type of software architecture has a lot of advantages like flexibility and ease at scale. Mapp...
End-to-End Microservice Tests with Cucumber and Sp... If you work with Microservices, you surely faced the situation in which some of your system processes only make sense after the information flows thro...


  1. I started off with a default spring boot application with hello world example and added your modifications. It builds and the war file is produced and deployed on WildFly 9.x but the application spits out a “Not Found” error when accessing it (http://localhost:8080/demo/greeting/?name=george)

    I’m using STS 3.7.1 RELEASE with WildFly 9.x

    Any idea what could be causing this? I’m not supposed to have a web.xml correct?

  2. So I don’t know why, I did a re-fresh on the project and re-published the war on wildfly and now everything works! I guess there was something old cached somewhere.

    Thanks for the good tutorial. Took me a while to find something up to date and simple like this to get me going.

  3. Hello

    I followed your tutorial to deploy the Spring Boot App of mine to Jboss but it doesn’t work. My Spring Boot App works fine with embedded tomcat but when I try to deploy it to external Tomcat or Jboss as a .war it always give me HTTP Status 404 .

    With embedded tomcat this URL works: localhost:8080/employees but when I deploy to external Tomcat or Jboss none of the below URL works for me:

    Looking for your reply. Thanks in advance.

    • Hi Ankit,
      Do you have your source code in GitHub so I can have a look? Actually that could be caused by many reasons…

  4. Hii,

    I followed ur post to deploy springBootApp to Jboss, but it giving error. My application is working fine with tomacat. but it giving error when trying to deploy JBOSS.
    The error as follows::Caused by: org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.context.ApplicationContextException: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.

    Looking for your reply.

    • Hi,
      Could you share your Application class? But it could be a JBoss configuration problem of the classpath, since it’s working fine with Tomcat (I guess not the embedded one).

    • My application class is as below:
      import org.springframework.boot.SpringApplication;
      import org.springframework.boot.autoconfigure.SpringBootApplication;
      import org.springframework.boot.builder.SpringApplicationBuilder;
      import org.springframework.boot.context.web.SpringBootServletInitializer;

      public class Application extends SpringBootServletInitializer
      protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
      return application.sources(Application.class);

      public static void main(String[] args)
      SpringApplication.run(Application.class, args);

      When i deployed the application on Jboss 6.4, i am not getting above mentioned problem. but, my application is still not running. when i am trying to run “http://localhost:8080/greeting” not getting any output …

      Looking for ur reply

  5. Thanks for the “extends SpringBootServletInitializer” part. This helped me further.

Leave a Reply