Migrating a Spring Boot application from an embedded Tomcat server to an external one means switching the packaging from an executable JAR to a deployable WAR that the external server can load.
After changing packaging to war and extending SpringBootServletInitializer, running mvn package produces app.war, which is dropped into Tomcat's webapps folder and picked up automatically on server startup.
public class Application extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return builder.sources(Application.class);
}
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}A concise interview answer is
I switch packaging from jar to war, mark the embedded Tomcat starter as provided so it doesn't clash with the external server, and extend SpringBootServletInitializer so the app registers correctly as a servlet context. Then I build the WAR and deploy it to the external Tomcat's webapps folder.
Last updated: 16 July 2026
Previous question: What are the pros and cons of using an embedded server in Spring Boot?
Next question: You have to deploy a Spring Boot application on both AWS and Azure. What would be your approach for each?