Spring Boot Introduction
Spring Boot is the most popular way to build back ends and REST APIs in Java. Banks, e-commerce sites and big Indian IT companies use it, and it's one of the most asked-for skills in Java job posts.
Spring Boot is the standard way to build Java back ends. It configures a web server, JSON handling, database access and security for you, following sensible defaults, so you write only your business logic. Many banks, e-commerce companies and IT services firms in India use it.
Spring Boot sets up a web server, JSON, database access and more for you, so you write only your app's own code.
What you need
- Java 17 or newer (Spring Boot 3 needs at least 17; 21 is a good choice). Our Java course uses Java 8 features, which all still work.
- An editor: IntelliJ IDEA (Community is free) or VS Code with the Java and Spring extensions
- Maven or Gradle (the project includes a wrapper, so you don't have to install them)
Create a project
Go to start.spring.io (Spring Initializr). Choose Maven, Java, the latest stable Spring Boot 3 version, group com.terixto, artifact shop, and add the dependencies Spring Web, Validation, Spring Data JPA and H2 Database. Click Generate, unzip, and open the folder in your editor.
shop/
├── pom.xml # project settings and dependencies
├── mvnw, mvnw.cmd # Maven wrapper
└── src/
├── main/java/com/terixto/shop/
│ └── ShopApplication.java # the starting point
├── main/resources/
│ └── application.properties # settings
└── test/java/... # testspackage com.terixto.shop;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class ShopApplication {
public static void main(String[] args) {
SpringApplication.run(ShopApplication.class, args);
}
}Run it
./mvnw spring-boot:run # Windows: mvnw.cmd spring-boot:run
# The log ends with lines like "Tomcat started on port 8080"
# and "Started ShopApplication in ... seconds"The app is now a web server on http://localhost:8080. It has no pages yet, so you'll see an error page - we'll add our first API in lesson 3.
@ like @SpringBootApplication are annotations. They tell Spring what each class is for. You'll meet many of them.- Spring Boot builds Java back ends and APIs.
- Create projects at start.spring.io.
- ./mvnw spring-boot:run starts the app.
