Author
Spring Boot provides multiple ways to run an application, making it suitable for development, testing, and production environments. You can run a Spring Boot app directly from an IDE, using build tools like Maven or Gradle, or as an executable JAR file.
This is the most common approach during development.
@SpringBootApplicationYou can run the application using Maven from the terminal:
mvn spring-boot:runFor Gradle-based projects, use:
gradle bootRun
or (recommended):
./gradlew bootRun
This is the most common production approach.
mvn clean package
java -jar myapp.jar
Spring profiles allow environment-specific configuration.
java -jar myapp.jar --spring.profiles.active=dev
Developer Action
│
▼
Choose Run Method
│
├── Run from IDE
│ │
│ └── @SpringBootApplication
│ ↓
│ Embedded Server Starts
│ ↓
│ Application Running
│
├── Maven (mvn spring-boot:run)
│ │
│ └── Compile + Dependencies
│ ↓
│ Spring Boot Startup
│ ↓
│ Application Running
│
├── Gradle (bootRun)
│ │
│ └── Gradle Build Lifecycle
│ ↓
│ Spring Boot Startup
│ ↓
│ Application Running
│
└── Executable JAR (java -jar)
│
└── JVM Starts
↓
Embedded Server
↓
Application Running
Spring Boot makes application execution simple, flexible, and production-ready.
Whether you run it from an IDE for development, use Maven or Gradle for automation, or deploy it as an executable JAR in production, Spring Boot handles everything with minimal configuration. Profile support ensures clean separation between environments, making Spring Boot ideal for modern and scalable applications.