Skill-Lite

Practical tutorials & tools for modern developers.

Home/Spring Boot/Introduction

Introduction to Spring Boot

Spring Boot makes it easy to create stand-alone, production-ready Spring applications with minimal configuration. It embraces convention over configuration — you write business logic, not boilerplate.

The problem Spring Boot solves

Classic Spring required extensive XML configuration or Java-based @Configuration classes just to get a web app running. Spring Boot flips this: it auto-configures sensible defaults so you can go from zero to a running HTTP server in minutes. You override only what you need to change.

Spring Boot vs Spring Framework

Spring FrameworkSpring Boot
ConfigurationManual — XML or @ConfigurationAuto-configuration, starter POMs
Embedded serverDeploy WAR to external Tomcat/JettyTomcat/Netty embedded — runs as a JAR
StartupHeavy setup requiredOne main class, one annotation
DependenciesChoose & version each individuallyStarter bundles handle compatible sets
Production-readyManual setup for health/metricsActuator endpoints built-in

Key features

  • Auto-configuration: Spring Boot detects JARs on the classpath and configures beans automatically.
  • Starter dependencies: spring-boot-starter-web pulls in MVC, Jackson, and an embedded Tomcat with one entry.
  • Embedded server: no WAR, no external app server — just java -jar app.jar.
  • Actuator: health checks, metrics, environment info via HTTP endpoints out of the box.
  • Spring Initializr: generate a project skeleton at start.spring.io.

Project structure

my-app/
├── src/
│   ├── main/
│   │   ├── java/com/example/myapp/
│   │   │   ├── MyAppApplication.java    ← entry point (@SpringBootApplication)
│   │   │   ├── controller/              ← REST controllers
│   │   │   ├── service/                 ← business logic
│   │   │   ├── repository/              ← data access (Spring Data)
│   │   │   └── model/                   ← entity / DTO classes
│   │   └── resources/
│   │       ├── application.properties   ← configuration
│   │       └── static/                  ← served as-is (HTML, CSS, JS)
│   └── test/
│       └── java/com/example/myapp/      ← test classes
├── pom.xml                              ← Maven build descriptor
└── mvnw                                 ← Maven wrapper (no local Maven needed)

The entry point

package com.example.myapp;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication   // = @Configuration + @EnableAutoConfiguration + @ComponentScan
public class MyAppApplication {
    public static void main(String[] args) {
        SpringApplication.run(MyAppApplication.class, args);
    }
}

That's it. @SpringBootApplication triggers component scanning of the package and all sub-packages, and enables auto-configuration for any starter jars on the classpath.

Maven starter

<parent>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-parent</artifactId>
  <version>3.3.0</version>
</parent>

<dependencies>
  <!-- Web: REST, MVC, embedded Tomcat -->
  <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
  </dependency>

  <!-- Tests: JUnit 5, Mockito, MockMvc -->
  <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-test</artifactId>
    <scope>test</scope>
  </dependency>
</dependencies>

Common starters

StarterWhat it includes
spring-boot-starter-webSpring MVC, Jackson, embedded Tomcat, validation
spring-boot-starter-data-jpaHibernate, Spring Data JPA, JDBC
spring-boot-starter-securitySpring Security, authentication & authorization
spring-boot-starter-testJUnit 5, Mockito, MockMvc, AssertJ
spring-boot-starter-actuatorHealth, metrics, env, info endpoints
spring-boot-starter-validationBean Validation (Hibernate Validator)
spring-boot-starter-cacheSpring Cache abstraction (plug in Redis, etc.)
spring-boot-starter-mailJavaMail + Spring's MailSender
spring-boot-starter-webfluxReactive web with Project Reactor / Netty

Running the application

# Maven Wrapper (no local Maven needed)
./mvnw spring-boot:run

# Or build a fat JAR and run it directly
./mvnw clean package
java -jar target/my-app-0.0.1-SNAPSHOT.jar

# The embedded Tomcat listens on port 8080 by default
curl http://localhost:8080/
Spring Initializr at start.spring.io generates a ready-to-run project. Pick your language (Java/Kotlin/Groovy), build tool (Maven/Gradle), Spring Boot version, and dependencies — then download and unzip.