A simple Spring Boot application that demonstrates a "Hello World" endpoint with a customizable message. This project is designed to be beginner-friendly and serves as a foundation for exploring Spring Boot features.
- A RESTful
/hello
endpoint. - Returns a friendly greeting message.
- Option to customize the greeting using a query parameter.
- Java 17 (OpenJDK)
- Spring Boot (Latest version)
- Maven (Build tool)
- IntelliJ IDEA (Development environment)
src/main/java/com/lahcencodes/springbootexplorer/
├── SpringBootExplorerApplication.java # Main application file
- URL:
http://localhost:8080/hello
- Method:
GET
- Description: Returns a greeting message.
- Query Parameter:
name
(optional): Customize the name in the greeting message.
-
Default greeting:
curl http://localhost:8080/hello
Response:
Hello World!
-
Custom greeting:
curl http://localhost:8080/hello?name=Lahcen
Response:
Hello Lahcen!
Ensure you have the following installed:
- Java 17 (OpenJDK 17)
- Maven (for building the project)
- Git (for cloning the repository)
-
Clone the Repository
git clone https://github.com/LahcenEzzara/spring-boot-explorer.git cd spring-boot-explorer
-
Build the Application
./mvnw clean install
-
Run the Application
./mvnw spring-boot:run
-
Open your browser or API testing tool and navigate to:
-
Default greeting:
curl http://localhost:8080/hello
-
Custom greeting:
curl http://localhost:8080/hello?name=LahcenCodes
- Create a new GET request.
- Enter the URL:
http://localhost:8080/hello
. - Add a query parameter (optional):
name=LahcenCodes
. - Send the request.
-
If running in the foreground: Press
Ctrl + C
to terminate the application. -
If running in the background: Find the process:
ps aux | grep java
Kill the process:
kill <PID>
This project is licensed under the MIT License. See the LICENSE file for details.
If you have any questions or need help, feel free to contact me via GitHub.
Happy coding! 🎉