Released · improving
Framework · Since 2014
Spring Boot is a Java and Kotlin server framework that lets you create stand-alone, production-ready Spring applications with minimal configuration.
Spring Boot builds on the Spring Framework to make it quick to create stand-alone, production-grade applications. Version 1.0 was released in 2014, and the project is developed in the open by the Spring team at Broadcom together with the community. Auto-configuration sets up the beans you are likely to need based on the classpath, and starters bundle the dependencies for each capability, so you can start writing code without XML or lengthy setup.
Spring Boot is widely used for server applications where reliability and maintainability matter: REST APIs, microservices, enterprise business systems and batch jobs. It integrates naturally with Spring Data, Spring Security, Spring Batch and the rest of the Spring portfolio, and because an application ships as a single executable jar with an embedded web server, it fits containers and cloud platforms well. Actuator adds production features such as health checks and metrics.
To get started, install a JDK, generate a project with the web dependency on Spring Initializr (start.spring.io), and follow the official guide Building a RESTful Web Service. From there, learn how dependency injection and auto-configuration work, then expand into Spring Data JPA and the testing support. The official reference documentation covers every feature and configuration property in detail.
Configures beans such as the web server, data source and JSON mapping based on the libraries on the classpath and your settings, and backs off when you define your own.
Curated dependency sets for web, data access, security, testing and more, so you do not have to work out compatible library versions yourself.
A web server such as Tomcat runs inside the application, so a single jar starts with java -jar or turns straight into a container image.
Actuator provides health, metrics and environment endpoints, while externalized configuration and profiles keep per-environment settings tidy.
Spring Boot runs on the JVM, so you need a JDK. See the system requirements in the official documentation for supported Java versions; the latest LTS release is a good choice. Gradle and Maven are downloaded by the project's wrapper, so there is nothing else to install.
java -versionDownload a project with the web dependency from Spring Initializr. The start.spring.io web page and the new-project wizards in IntelliJ IDEA or VS Code produce the same result.
curl https://start.spring.io/starter.zip -d dependencies=web -d baseDir=demo -o demo.zip && unzip demo.zipRun the application with the Gradle wrapper and the embedded web server listens on port 8080. For a Maven project use ./mvnw spring-boot:run, and on Windows use gradlew.bat bootRun.
cd demo && ./gradlew bootRun@SpringBootApplication marks the entry point and turns on auto-configuration and component scanning, and SpringApplication.run in the main method starts the application together with its embedded web server. The class is also a @RestController with a @GetMapping route, so after ./gradlew bootRun you can open http://localhost:8080/ in a browser and see Hello, World!.
src/main/java/com/example/demo/DemoApplication.java
package com.example.demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@SpringBootApplication
@RestController
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
@GetMapping("/")
public String hello() {
return "Hello, World!";
}
}
./gradlew bootRunSix chapters that take you from installation to the core ideas of Spring Boot.
Ask questions, share experience and trade opinions about Spring Boot.
No discussions yet. Start the first one.
0 comments
Sign in · Sign in to leave a comment.
Be the first to comment.