What are the ways to deploy a Spring Boot application?

A Spring Boot application can be deployed in a few standard ways, depending on how much control you need over the runtime environment.

Key Points

Example

A typical modern setup builds the app into a Docker image with a Dockerfile based on eclipse-temurin, pushes it to a container registry, and deploys it to a Kubernetes cluster with a Deployment and Service manifest.

# 1. Executable JAR with the embedded server
./mvnw clean package
java -jar target/shop-1.0.jar --spring.profiles.active=prod

# 2. Container image without writing a Dockerfile (Cloud Native Buildpacks)
./mvnw spring-boot:build-image -Dspring-boot.build-image.imageName=shop:1.0
docker run -p 8080:8080 shop:1.0

# 3. Kubernetes: deploy the image with a Deployment and Service
kubectl apply -f k8s/deployment.yaml

# 4. Traditional WAR on an external Tomcat (packaging=war and
#    a SpringBootServletInitializer subclass)
cp target/shop-1.0.war $CATALINA_HOME/webapps/

Interview Tip

A concise interview answer is

The simplest option is packaging as a self-contained JAR with an embedded server and running it with java -jar. For enterprise environments you can still build a WAR for an external Tomcat, but the more common modern path is containerizing the app with Docker and deploying it to Kubernetes or a cloud PaaS for scaling and orchestration.

Last updated: 1 November 2026

Previous question: You're tasked with validating user input across multiple forms in a Spring Boot web application. Describe your approach to maintain consistency in validation rules.

Next question: How does Spring Boot simplify the deployment process compared to traditional Spring applications?

More Spring Boot - Level IV (Advanced) interview questions

All Spring Boot - Level IV (Advanced) questions