Skip to content

Latest commit

 

History

History
93 lines (70 loc) · 3.48 KB

File metadata and controls

93 lines (70 loc) · 3.48 KB

Spring Boot REST Service

Coverage Mutation SpotBugs

Part of the java-spring-tutorials collection of Spring.io guide implementations.

A simple Spring Boot application that demonstrates how to build a RESTful web service.

Overview

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!"
}

Project Structure

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

Quick Start

Run the application:

./mvnw spring-boot:run

Then open your browser to:

http://localhost:8080/greeting
http://localhost:8080/greeting?name=YourName

Example: /greeting

Screenshot 2025-12-10 at 12 10 28 PM

Example: /greeting?name=Justin

Screenshot 2025-12-10 at 12 10 51 PM

Documentation

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

Getting Started

  1. Start with spring-initializr.md to understand how the project was created
  2. Read rest-controller-greeting.md to understand how the REST endpoint works
  3. Follow run-instructions.md to run the application

Technologies

  • Java 17+
  • Spring Boot 4.0.0
  • Maven