Skip to content

Instantly share code, notes, and snippets.

@kavicastelo
Created April 23, 2025 17:02
Show Gist options
  • Select an option

  • Save kavicastelo/6e995dc20598ae8c58361606da608781 to your computer and use it in GitHub Desktop.

Select an option

Save kavicastelo/6e995dc20598ae8c58361606da608781 to your computer and use it in GitHub Desktop.
Spring Boot Learning Module 1 (Interns) – Basics (REST API Essentials)
public class Greeting {
private String message;
// constructor, getter, setter
}
@RestController
@RequestMapping("/api")
public class GreetingController {
@GetMapping("/hello")
public Greeting sayHello() {
return new Greeting("Hello, Intern!");
}
@GetMapping("/hello/{name}")
public Greeting greetUser(@PathVariable String name) {
return new Greeting("Hi, " + name + " 👋");
}
}
springboot-module-1/
├── src/
│   └── main/
│       ├── java/
│       │   └── com.example.module1/
│       │       ├── controller/
│       │       │   └── GreetingController.java
│       │       ├── model/
│       │       │   └── Greeting.java
│       │       └── SpringBootModule1Application.java
│       └── resources/
│           └── application.properties
├── README.md
└── pom.xml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment