codingstairs
NotesEDULifeContact
⌕Search⌘K
koen

Navigation

  • Intro
  • Blog
  • Life

Get in touch

Send without signing in. Add your email if you'd like a reply.

  • Leave a message anonymously →
  • ✉ warragon112@gmail.com
  • KakaoTalk Open Chat ↗

© 2026 codingstairs

  • Notes
  • EDU
  • Search
  • Life
  • Contact
  • Legal
  • RSS
  • GitHub
EDU›Backend with Spring Boot 4›Step 2

Step 2

Step 2 — First Spring Boot 4 project

0 views

Step 2 — First Spring Boot 4 project

start.spring.io is the standard starting point.

Settings

  • Project: Gradle - Kotlin DSL
  • Language: Java
  • Spring Boot: 4.0.x
  • Java: 21
  • Dependencies: Spring Web, Spring Data JPA, PostgreSQL Driver, Lombok, Validation

Generate → unzip → open in IntelliJ or VS Code.

First controller

@RestController
@RequestMapping("/api/hello")
public class HelloController {

    @GetMapping
    public String hello() { return "Hello, Spring!"; }

    @GetMapping("/{name}")
    public String greet(@PathVariable String name) { return "Hello, " + name + "!"; }
}

@RestController = JSON-response controller. @GetMapping = GET only.

Run

./gradlew bootRun

Default port 8080. Visit http://localhost:8080/api/hello.

Folder structure

demo/
├── build.gradle.kts
├── src/main/
│   ├── java/com/example/demo/
│   │   ├── DemoApplication.java   ← entry (@SpringBootApplication)
│   │   └── HelloController.java
│   └── resources/
│       ├── application.yml        ← DB URL, port
│       └── static/
└── src/test/

Try it

Add @PostMapping("/echo") that echoes the request body. Use @RequestBody Map<String, Object> for auto JSON parsing.

Next

Step 3 treats SQL as the single source of truth.

← Step 1

Step 1 — What is a backend?

Step 3 →

Step 3 — SQL as SSOT