This is a secure Spring Boot CRUD (Create, Read, Update, Delete) application that interacts with a MySQL database. It incorporates HTTPS for secure communication and JWT for authentication/authorization.
- Secure CRUD endpoints for managing items in the MySQL database.
- Uses HTTPS for secure communication.
- Implements JWT authentication for stateless and token-based security.
- Java JDK 17
- MySQL Server
- Clone the repository to your local machine:
git clone https://github.com/giovannigv/SpringBootCRUD.git
cd SpringBootCRUD-
Set up the MySQL Database:
- Create a new MySQL database for the application.
- Update the
application.propertiesfile with your MySQL database credentials (in the "MySQL configuration" section).
-
Run the Application:
Use your favorite IDE or run the following command from the project root:
gradle spring-boot:runThe application should now be accessible at https://localhost:8000.
- Access the Application:
Open your web browser and navigate to https://localhost:8000.
- Authentication
This application uses JWT (JSON Web Tokens) for authentication. When making requests to secure endpoints, include the JWT token in the request headers.
To obtain a JWT token:
- Send a POST request to
/authenticatewith JSON payload containing your username and password:
- CRUD Operations:
- Once authenticated, you can access the secure CRUD endpoints for managing items in the database.
- Use tools like Postman to test the CRUD endpoints.
ROUTE: /api/product, /api/order
GET - List all items in the database.
POST - Create a new item in the database.
PUT - Update an existing item in the database.
DELETE - Delete an existing item from the database.
- Secure Communication:
- All communication with the application is over HTTPS, ensuring secure data transfer.
- This is a basic example application and should not be used in production without further enhancements.
- The application uses JWT tokens for authentication, which are stateless and do not require server-side session management.
- Make sure to keep your JWT secret key secure and avoid exposing it in the codebase or publicly accessible locations.
- For production deployment, consider using a production-grade database and securely managing JWT secret keys.
This project is licensed under the MIT License.