How to Deploy a Spring Boot Application on Tomcat as a WAR Package [Intermediate Spring Boot]

Dan Geabunea (Romanian Coder) · 97K views · 2017 · 28:43

Open on YouTube

Web developmentSoftware architecture & designtutorialdated

Why Stack Overflow recommends it

Stack Overflow users link it when answering why a Spring Boot WAR will not build or deploy to an external Tomcat, since it shows the packaging and servlet initializer setup that fixes those problems.

Recommended by 3 people across 3 different months, 2018 to 2019.

What it is

A 28-minute step-by-step tutorial by Dan Geabunea (Romanian Coder) on converting a standard Spring Boot application, which normally runs as a JAR with an embedded container, into a WAR package. It then shows how to deploy that WAR to a standalone Tomcat server. Source code is provided on GitHub.

What people said

Recommends Mateut Alin · 2018-09 · Stack Overflow · on “How to build a WAR file with gradle?”

I want to build a WAR file (and then deploy it to Tomcat). So, as an exercise, I've started a new Spring Boot Project using Gradle in IDEA IntelliJ. Afterwards, I've apply the plugin in the build.gradle file, like this apply plugin: 'war' . The problem is that when I try to run gradle war in the terminal, I get no war file! The only thing that happens is that it will generate a \build with 3 subsolders classes , resources and tmp , but there's no WAR in these. What should I do to get a WAR file? I've watched this [this video] video, but this guy uses Maven and doesn't do advanced stuff and gets the war. I think there's got to be a way to keep it simple. When I run gradle war --info Initialized na

Recommends Cocuthemyth · 2018-12 · Stack Overflow · on “Not able to deploy springboot application in an external tomcat”

As an addition @Gableg's answer, in pom.xml : <packaging>war</packaging> set as war not jar. Basically @Gableg's two condition and my condition i specified above is enough. Tree condition is enough to make an app deployable in external tomcat. I referenced the video in below.It is really usable. [this video]

Recommends geppy · 2019-07 · Stack Overflow · on “Deploying a WAR file gives me a 404 Status Code on Tomcat?”

If your'e using Spring-Boot like me to create your WAR file make sure to add the following to your main Application file. @SpringBootApplication public class serverTestApplication extends SpringBootServletInitializer { public static void main(String[] args) { SpringApplication.run(serverTestApplication.class, args); } @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { return builder.sources(serverTestApplication.class); } } I was stuck on this for awhile, looked through dozens of guides. This is the video that finally showed me I never configured my application properly: [this video]