This is a simple Spring Boot project which discreetly uses below features. Will keep enhancing this project from learning and practice perspective.
- Add dependency and @OpenAPIDefinition in main class.
- Then hit below URL and copy to project and edit accordingly.
- Then Access Swagger URL below.
http://localhost:8080/swagger-ui/index.html?configUrl=/v3/api-docs/swagger-config
- In memory Database has been used. It can be accessed below.
- Spring's default caching has been used in this project for frequently accessed API Endpoints.
- Once empty, DB not checked until TTL(Time to Live), so perform DB check if empty.
- Using keys and sync is recommended. Refer further details below
https://www.foreach.be/blog/spring-cache-annotations-some-tips-tricks
- Have kept scheduler to perform scheduled tasks. Change cron.expression as required.
- Used @RestControllerAdvice to have centralized exception handling across all Controller classes
- Avoided use of @ResponseStatus which makes code tightly coupled
- Tomcat Servlet Container redirects to \error by default
- Always have NoHandlerFoundException for API Endpoints not created so as to segregate it from other issues of Legacy Internal Server Errors
- MethodArgumentNotValidException for arguments when empty, null or not given. POJO must have @Valid check. Refer this link
- Common exceptions can be clubbed as Exception Arrays as used in this project
- Used Identity Strategy here with allocation size 25
- Have avoided using direct JSON Arrays in API response. Please find reason below in link.
- One Product is owned by one member - @OneToOne
- One Member can own multiple Products - @OneToMany
- Refer Notes
- In Progress
- Twilio SMS Notification
- Email Integration
- In Progress
- In Progress
For further reference, please consider the following sections:
- Official Apache Maven documentation
- Spring Boot Maven Plugin Reference Guide
- Create an OCI image
- Spring Web
- Spring Boot DevTools
The following guides illustrate how to use some features concretely: