It is a tutorial project for a full java server side web application using Spring Boot.
In my past projects I've used:
- Jersey - as a JAX-RS provider for developing RESTful Web Services in Java.
- Hibernate - as a JPA provider to takes care of the mapping from Java classes to database tables (and from Java data types to SQL data types), but also provides data query and retrieval facilities.
- Spring IoC Container - for dependency injection.
- JUnit and Mockito - for testing ofcourse.
Now I could use them all in one.
Spring's 'opinionated' default configuration fits most (but not all) application's needs.
I also used: Lombok - that prevented me from writing boilerplate code with no real value to project business side. For example I didn't needed to implement constructors, getters/setters, equals/hashCode or even implement the Builder pattern for my DTOs.
This project has a very simple and straightforward business logic. My focus was at the technological POV.
- Clone this github repository to you local repo/FS
- Import it as a maven project to you STS
- In you MySQL DBMS create a DB named "messgae_sys_schema" (set userName and password 'root')
- Run the App as 'Spring Boot App'
- Open Postman and use the URLs from the list below.
There are three main entities: a user, message and comment.
- Use cases: Create/get/update/delete User
URL: http://localhost:8080/api/users/{id} - Use cases: Create/get/update/delete Message
URL: http://localhost:8080/api/users/{usrId}/messages/{msgId} - Use cases: Create a Comment for specific Message
URL: http://localhost:8080/api/users/{usrId}/messages/{msgId}/comments
-
com.mycomp.mymessagesys.controller:
RestControllerInterface.java
UsersController.java
MessageController.java
CommentController.java -
com.mycomp.mymessagesys.service:
UserService.java
UserServiceImpl.java
MessageService.java
MessageServiceImpl.java
CommentService.java
CommentServiceImpl.java -
com.mycomp.mymessagesys.repository:
UserDAO.java
MessageDAO.java
CommentDAO.java -
com.mycomp.mymessagesys.model:
UserDTO.java BaseMessage.java MessageDTO.java
CommentDTO.java -
com.mycomp.mymessagesys.service.exceptions:
InvalidMessageIdException.java
InvalidUserIdException.java
- Unit tests
1.1. Per Controllers:
com.mycomp.mymessagesys.controller.unit_tests.UsersControllerTest.java
com.mycomp.mymessagesys.controller.unit_tests.MessageControllerTest.java
com.mycomp.mymessagesys.controller.unit_tests.CommentControllerTest.java
1.2. Per Services:
com.mycomp.mymessagesys.service.unit_tests.UserServiceImplTest.java
com.mycomp.mymessagesys.service.unit_tests.MessageServiceImplTest.java
com.mycomp.mymessagesys.service.unit_tests.CommentServiceImplTest.java - Component Integration Tests
2.1 Per Entity repository:
com.mycomp.mymessagesys.repository.component_integration_tests.TestUserRepo.java
com.mycomp.mymessagesys.repository.component_integration_tests.TestMessageRepo.java (TBD)
com.mycomp.mymessagesys.repository.component_integration_tests.TestCommentRepo.java (TBD) - System Integration Tests
2.1 Per Entity repository:
com.mycomp.mymessagesys.repository.system_integration_tests.TestUserRepo.java (TBD)
com.mycomp.mymessagesys.repository.system_integration_tests.TestMessageRepo.java (TBD)
com.mycomp.mymessagesys.repository.system_integration_tests.TestCommentRepo.java (TBD)
- Check tests run instability
- Add Entity mapping for Message<=>Comment
- Complete all the (TBD) tests
- Add loggings
'Get all Messages' call retrieved also all Comments (could be due to the fact that Message is super class to Comment).