This project was generated with Spring Initializer version 2.5.10.
The application starts on http://localhost:8080.
This project has the purpose to get involved with Spring Boot (Java, Maven), Docker and GitHub (Actions, Packages, Projects).
The application is a Spring Boot REST API that provides features to manage data in a MySQL database. The data includes several entities that are related to the weekly food shopping and planning the meals. The basic features are all about managing the data first and provide the correct connections between the entities. The advances features are operations between the entities, for example you plan a recipe for the next week and add it with this operation to your shopping cart.
Http Entrypoint <-- Security Filter
| |
Models --> Controller <-- Configuration <-- Main
| |
| Database
| |
Entity --> Repository
|
MySQL DBMS
Explanations
- Http Entrypoint =
localhost:8080/request-path
- Security Filter = security-package
- Configuration = configuration-package
- Main = Main Class
- Controller = controller-package
- Models = model-package
- Database = DB-classes in database package
- Repository = Repository-classes in database package
- Entity = Entity-classes in database package
- MySQL DBMS =
mysql://localhost:3306
Dockerfile
- Dockerfile
- Multistage Build: Builder & Runner
- Image with Alpine JDK and the executable
JAR
- Exposes
Port 8080
- Uses by default MySQL DB at
Port 3306
- Detailed configuration: prod.properties
Continuous Integration Workflow
- .github/workflows/ci.yml
- Trigger: all pushes
- Executes
mvn install
- Run
mvn test
with MySQL DB - Perform CodeQL Analysis with Java
Docker Image Delivery Workflow
- .github/workflows/docker-image.yml
- Trigger: manual or on published release
- Executes
docker build
- Execute
docker push
to GitHub Packages
- Download and Install Java Development Kit v17.0+
- Add
JAVA_HOME
- Update
PATH
- Add
- Download and Install Maven v3.8.4+
- Add
MAVEN_HOME
- Update
PATH
- Add
- Download and Install MySQL Server v8.0+
- Check application.properties for correct configuration
- IDEA Configuration for Spring Dev Tools
- The Spring Dev Tools enable hot-swap the make development faster. When a new Build gets started, it
automatically restarts the application. To make the best use of it, activate following settings:
Settings > Build, Execution, Deployment > Compiler > Build project automatically
Registry > compiler.automake.allow.when.app.running
- The Spring Dev Tools enable hot-swap the make development faster. When a new Build gets started, it
automatically restarts the application. To make the best use of it, activate following settings:
- Download and Install Docker
- Build Image:
docker build -t fresh-planner-api .
- Build Image:
- Spring Web
- Guide Web Service: Building a REST Web Service
- Lombok
- Spring Boot DevTools
- SpringFox Swagger UI
- Spring Data JPA
- Guide JPA: Accessing Data with JPA
- Guide MySQL: Accessing data with MySQL
- Spring Security with JWT
- Spring Boot Validation
- Spring Boot Maven Plugin