When I first started working with Java, building a web application felt heavy. A lot of configuration, XML everywhere, and you had to manually set up servers. That all changed when I discovered Spring Boot.
If you're new to Spring or you want a clean starting point for backend development, this walks you through what Spring Boot is and how to build a simple REST API.
Spring Boot is a framework that makes it easy to create Java applications with almost no configuration.
It handles the heavy lifting for you:
No XML files
No manual server setup
No complicated dependency wiring
You just write your code, run the application, and Spring Boot takes care of the rest.
Here are the things that made me personally appreciate Spring Boot:
it has an embedded server.
auto configuration .
very fast to get started .
Go to : spring.io
Choose:
Project: Maven
Language: Java
Dependencies: Spring Web
Download the project and open it in your IDE .
Spring Boot generates everything you need to start immediately.
Inside your project, create a new class:
HelloController.java
package com.example.demo.controllers;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class HelloController {
@GetMapping("/hello")
public String hello() {
return "Hello World!";
}
}
That’s it.
@RestController tells Spring this class will handle HTTP requests
@GetMapping("/hello") exposes a GET endpoint at /hello
The method returns a simple string
You can run the project in two ways:
Simply run the main() method inside DemoApplication.java.
Open your terminal and run:
mvn spring-boot:run
The app starts on port 8080 by default.
Now open:
You should see:
Hello World!
Spring Boot uses application.properties or application.yml to configure your app.
For example, to change the port:
server.port=2025
Or using YAML:
server:
port: 2025
Restart the app, and it will now run on:
If you're starting your Spring journey, here are the next topics you should take a look at:
Building CRUD APIs
Working with Spring Data JPA
Using profiles (dev, test, prod)
Global exception handling
Testing with JUnit and Mockito