springboot-module-1/
├── src/
│ └── main/
│ ├── java/
│ │ └── com.example.module1/
│ │ ├── controller/
│ │ │ └── GreetingController.java
│ │ ├── model/
│ │ │ └── Greeting.java
│ │ └── SpringBootModule1Application.java
│ └── resources/
│ └── application.properties
├── README.md
└── pom.xml
Created
April 23, 2025 17:02
-
-
Save kavicastelo/6e995dc20598ae8c58361606da608781 to your computer and use it in GitHub Desktop.
Spring Boot Learning Module 1 (Interns) – Basics (REST API Essentials)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class Greeting { | |
| private String message; | |
| // constructor, getter, setter | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @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 + " 👋"); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment