This project should test your knowledge of Spring in creating a simple REST API for enlisting students in classes.
The domain classes are already provided; so are the persistence layer (DAO) interfaces, the service layer interfaces, web controllers, exceptions, and data transfer objects (DTO).
You just need to provide implementations for the DAO and service layers. Also, you need to provide the implementations of the handlers in the controller classes.
Search for all TODO comments. In IntelliJ IDEA, you can see these comments from a separate window:
View > Tool Windows > TODO. In Eclipse/STS, they are displayed in the Tasks view.
If not already displayed, click on Window -> Show View -> Tasks (be careful, not Task List).
If you can't see the Tasks view, try clicking Other ... and looking under General.
Please read the documentation and comments in each class as they will be your guide on how to complete the required specifications.
Spring Security has also been set up. You just need to secure the endpoints.
To run the application, you can use either Maven or Gradle. Just execute the following command:
(for *nix machines)
./mvnw spring-boot:run(for Windows machines)
mvnw spring-boot:run(for *nix machines)
./gradlew bootRun(for Windows machines)
gradlew bootRunYou can access the application via http://localhost:8080. You may use any tool you prefer for testing API calls (e.g., Postman, Fiddler, etc.).
No need to set up the database as that has already been done for you. An H2 database will be used. You may access http://localhost:8080/h2-console to check the contents of the database:
Just input the following details:
- Driver Class:
org.h2.Driver - JDBC URL:
jdbc:h2:mem:skipp - User Name:
sa - Password:
To run all tests, you can use either Maven or Gradle. Just execute the following command:
(for *nix machines)
./mvnw test(for Windows machines)
mvnw test(for *nix machines)
./gradlew test(for Windows machines)
gradlew testNote: The tests will be used to check for completion of requirements.
- Implement the persistence layer classes.
- Implement the service layer classes.
- Implement the controller handler methods. Provide correct mapping of HTTP methods to each.
- Handle exceptions gracefully; return proper response status codes.
- Provide meaningful messages for error scenarios.
- HTTP Basic authentication will be used for securing the endpoints.
- For each student created, create a record in the
userstable with the following specs:- The
usernameshould beST-+ theidfrom thestudentstable. - The
passwordshould befirst_name+last_namefrom thestudentstable.- Remove spaces.
- Use the existing
PasswordEncoderto encrypt the password before saving to the database.
- The
roleshould beSTUDENT.
- The
- For each faculty created, create a record in the
userstable with the following specs:- The
usernameshould beFC-+ theidfrom thefacultytable. - The
passwordshould befirst_name+last_namefrom thefacultytable. - The
roleshould beFACULTY.
- The
- Students:
- cannot add/edit/delete rooms, subjects, or sections.
- can view/list rooms, subjects, and sections.
- can only view their own details.
- cannot view/list all other students.
- can view all sections.
- can enlist in sections. Validations apply.
- cannot enlist other students to a section.
- Faculty:
- can add/view/edit/delete rooms, subjects, or sections.
- can add/view/edit/delete students or faculty.
- cannot enlist themselves or any student.
- More detailed instructions (and hints) are included in the source code. Take time to read them.
- Do NOT modify all the other classes.
Additional (optional) feature to showcase advanced Spring Boot knowledge:
- API Documentation using OpenAPI/Swagger. Use these links as references:
Functionality (60%):
- Endpoint Implementation: Were all required endpoints implemented correctly according to the provided interface classes?
- Request Handling: Do the implemented endpoints handle requests properly? Including request parameters, request bodies, headers, and response codes?
Code Quality (40%):
- Readability: Were proper coding conventions followed? Is the code well-structured and easy to understand?
- Error Handling: Were errors and exceptions handled gracefully? Are meaningful error messages provided to clients?
- Coding Best Practices: Were best practices such as proper naming conventions, avoiding code duplication, and SOLID principles followed?
- Documentation (10%):
- Is OpenAPI/Swagger documentation available? (5%)
- Do the endpoints and entities have user-friendly descriptions? (5%)
