This is a simple Spring Boot application that implements a REST API for CRUD operations on products.
- ➕ Create new products
- 📄 Retrieve all products
- 🔍 Retrieve a specific product by ID
- 🛠️ Update an existing product
- ❌ Delete a product
- Spring Boot
- Spring Data JPA
- Lombok (optional)
- Spring HATEOAS (optional)
pom.xml
: Defines project dependencies and configuration.src/main/java/
: Contains Java source code for models, controllers, and services.models
: Defines theProductModel
class representing a product entity.controllers
: Contains theProductController
class handling product-related API requests.
src/main/resources/
: (Optional) Contains application properties files.
- Ensure you have Maven installed.
- Clone this repository.
- Navigate to the project directory in your terminal.
- Run
mvn clean install
. - The application will start on a default port (usually 8080). You can access the API endpoints using tools like Postman or curl.
Method | URL | Description |
---|---|---|
POST | /products |
➕ Creates a new product |
GET | /products |
📄 Retrieves all products |
GET | /products/{id} |
🔍 Retrieves a specific product by ID |
PUT | /products/{id} |
🛠️ Updates an existing product |
DELETE | /products/{id} |
❌ Deletes a product |
- The provided code utilizes Lombok annotations for cleaner code (optional).
- Spring HATEOAS is included as a dependency (optional) for adding self-referencing links and relationships to responses.
- This is a basic example. You can extend it to include features like user authentication, product categories, etc.
- Refer to the official Spring Boot documentation for more details on configuration and functionalities.