List of contents:
-
Appendix - a bit more information about my approach to write this application.
It is a CRUD application that serves me as a development sandbox. Its main goals are:
- combining various aspects previously learned and used in separate tiny training applications
- encountering problems and solving them
- building a layered application
- creating a REST API
- covering the code with tests
- gaining experiences
Its business goal is to manage food products in terms of their suitability for consumption.
- Database:
- at the very beginning MySQL,
- finally in-memory H2
- Java 8+
- Spring Boot
- Hibernate
- Lombok
- JUnit
- Mockito
- Maven
- JaCoCo
- OpenAPI Swagger
- Postman
- IntelliJ
- Git
- GitBash
- GitHub
- UUID.class
- n+1 problem
- LocalDate.class as an entity property
- configuring of login levels
- stack overflow exception caused by bidirectional table relations
- DTOs
- deploying MySQL database to Amazon Web Services - RDS
- handling exceptions with AOP approach
- Java Code Coverage tool
- Builder pattern
- usefulness of unit tests during refactoring
- ... and couple others
- Database
- REST API
- Improve overall consistency
- Tests
- Integration with Open Food Facts API
- Logging
- Any others that I don't know about yet ;)
Windows, Linux, macOS, Android.
(In case of Android I
recommend Termux as a CLI.)
-
Download and install the latest Java Runtime Enviroment (JRE)
-
Use the chosen CLI to verify if the installation passed successfully, by typing
java -version
As a result you should see a similar response
java version "21.0.3" 2024-04-16 LTS Java(TM) SE Runtime Environment (build 21.0.3+7-LTS-152) Java HotSpot(TM) 64-Bit Server VM (build 21.0.3+7-LTS-152, mixed mode, sharing)
-
Download a jar file from the GitHub - Releases section
-
Again use the CLI to go to a folder that contains the downloaded file and run it ( the jar file name may vary )
java -jar foodToEat-0.0.1-SNAPSHOT.jar
-
Use the following URL with a web browser http://localhost:8081/swagger-ui/index.html#/
-
You should see a similar page. Use it to test the application.
- To stop the application press CTRL + C in the CLI.
To get a default Spring Boot - Open API documentation click the link just below the application title - (/v3/api-docs)
I approached this project several times.
At the very beginning, I thought that I would immediately develop an application that goes beyond a typical CRUD
functionality, with a database structured on several tables connected by 1:1, N:1, N:M relationships.
However, the first project, novice-level experience, too much complexity for the first application and limited time
forced me to simplify it to its current form.
The version presented here is:
- the most advanced in terms of code completeness
- the simplest in terms of business complexity
The first step is done. There are still some work to do.
And for the future, I already feel more comfortable approaching a new personal project that I have in mind :).