← Spring Boot learning path
Spring Boot · Module 10 of 10

Packaging and deployment

Build JARs, containers and deploy to the cloud.

📖 Key ideas

  1. mvn package or ./gradlew build creates an executable JAR.
  2. Build images with Dockerfile or ./mvnw spring-boot:build-image.
  3. Deploy to AWS, Azure, Google Cloud Run, Kubernetes or a VM.
  4. Database migrations with Flyway or Liquibase run on startup.
  5. Tune JVM memory and use graceful shutdown.
💡 Real-life example: A fat JAR is a packed suitcase: everything the trip needs, including the server, in one bag.
Fat JARExecutable JAR with all dependencies
FlywayVersioned database migrations
BuildpacksBuild images without Dockerfiles
Graceful shutdownFinish requests before stopping