Home » Java » Enterprise Java » Spring Boot for war

About Eidher Julian

Eidher Julian Cadavid
Eidher Julian is a Systems Engineer and Software Engineering Specialist with 13+ years of experience as a Java developer. He is an Oracle Certified Associate and SOA Certified Architect.

Spring Boot for war

Spring Boot supports the following embedded servlet containers:

  • Tomcat
  • Jetty
  • Undertow

You can use Maven, Gradle, or Ant/Ivy as build tools to generate the jar file. However, you may need to use your own server as WebLogic, Wildfly, JBoss, etc. In that case, you would need to generate a WAR file of your Spring Boot project. To do that you have to do the next changes:

  • Change artifact type to WAR
  • Extend SpringBootServletInitializer
  • Override the configure method
@SpringBootApplication
public class Application extends SpringBootServletInitializer {

    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(Application.class);
    }
}

mvn package will create a hybrid and a traditional (.original) WAR. The traditional WAR is produced without the embedded tomcat. So, you can use the .war.original file in your application server.

Published on Java Code Geeks with permission by Eidher Julian, partner at our JCG program. See the original article here: Spring Boot for war

Opinions expressed by Java Code Geeks contributors are their own.

(0 rating, 0 votes)
You need to be a registered member to rate this.
Start the discussion Views Tweet it!
Do you want to know how to develop your skillset to become a Java Rockstar?
Subscribe to our newsletter to start Rocking right now!
To get you started we give you our best selling eBooks for FREE!
1. JPA Mini Book
2. JVM Troubleshooting Guide
3. JUnit Tutorial for Unit Testing
4. Java Annotations Tutorial
5. Java Interview Questions
6. Spring Interview Questions
7. Android UI Design
and many more ....
I agree to the Terms and Privacy Policy
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Inline Feedbacks
View all comments