You need to migrate an application from an embedded Tomcat to an external Tomcat server. What steps would you follow?

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.

Key Points

Example

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);
    }
}

Interview Tip

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?

More Spring Boot - Level IV (Advanced) interview questions

All Spring Boot - Level IV (Advanced) questions