Part of the
java-spring-tutorialscollection of Spring.io guide implementations.
A simple Spring Boot application that demonstrates how to build a RESTful web service.
This project creates a REST endpoint that returns a greeting message as JSON.
When you call /greeting, you get a response like:
{
"id": 1,
"content": "Hello, World!"
}01-spring-hello-rest/
├── src/
│ ├── main/java/com/example/restservice/
│ │ ├── RestServiceApplication.java # Main entry point
│ │ ├── Greeting.java # Data record
│ │ └── GreetingController.java # REST controller
│ └── test/java/com/example/restservice/
│ ├── GreetingControllerTest.java # Controller tests
│ └── RestServiceApplicationTests.java
├── docs/
│ ├── images/ # Screenshots
│ ├── setup/
│ │ ├── spring-initializr.md # Project setup from start.spring.io
│ │ └── run-instructions.md # How to build and run
│ ├── concepts/
│ │ └── rest-controller-greeting.md # GreetingController explanation
│ └── reference/
│ └── guide.md # Original Spring guide
├── pom.xml # Maven configuration
└── mvnw # Maven wrapper
Run the application:
./mvnw spring-boot:runThen open your browser to:
http://localhost:8080/greeting
http://localhost:8080/greeting?name=YourName
| File | Description |
|---|---|
| spring-initializr.md | How to create the project using Spring Initializr |
| rest-controller-greeting.md | Detailed explanation of the GreetingController |
| run-instructions.md | How to build and run the application |
| guide.md | Original Spring guide reference |
- Start with spring-initializr.md to understand how the project was created
- Read rest-controller-greeting.md to understand how the REST endpoint works
- Follow run-instructions.md to run the application
- Java 17+
- Spring Boot 4.0.0
- Maven

