TRAINING MANUAL

Trainer guide & classroom plan

Use the three implementations as a connected course, with a clear demo sequence and measurable outcomes.

Optional prerequisite days · Java web basics

For students who know Core Java but have not used Servlets or JSP, teach Manual 00 before Day 1 of the Spring plan. Reserve 1–2 days (8–12 hours): HTML/HTTP and Tomcat setup; first Servlet and request inspection; JSP/EL/JSTL; session-backed CRUD; filters, validation, and the transition to Spring.

Completion criteria: each student deploys the WAR, performs CRUD, demonstrates independent sessions, and explains parameters versus attributes and forward versus redirect. Students already competent in these areas can skip this prerequisite.

1. Suggested 5-day delivery plan

DayTopics and demonstrationsLearner output
1 · 6 hoursTool setup; Spring versus Boot; IoC and beans; constructor injection; request lifecycle; Atlas setupTrace a request and establish an Atlas connection.
2 · 6 hoursManual 01; document and repository; service; controller; templates; validation and CSRF; persistent CRUDWorking Thymeleaf app and a field-extension exercise.
3 · 6 hoursManual 02; HTTP contracts; DTOs; JSON conversion; errors; Postman variables and assertionsWorking REST API plus successful negative tests.
4 · 6 hoursManual 03 backend; password hashing; JWT issuance and verification; ownership; CORS/CSRF distinctionsAlice/Bob API isolation proved in Postman.
5 · 6 hoursReact state and events; fetch; token lifetime; UI CRUD; full verification; deployment discussionPersonal todo frontend and final demonstration.

2. Prepare before learners arrive

  1. Extract the bundle and open index.html locally.
  2. Verify JDK and Maven using their version commands. Verify Node for Day 5.
  3. Create your Atlas database user and IP rule. Set credentials in your launch terminal.
  4. Start each backend once to download dependencies and verify its actual database operations.
  5. Run npm install and npm run build in the React folder before class to discover proxy/network problems early.
  6. Import Postman collections and the environment. Run them against the local APIs.
  7. Keep a clean training database or use unique account emails for repeated demos.
  8. Use your own database URI privately; display only placeholder configuration on a projector.

Source and documents are ready to use. First-time downloads and actual Atlas provisioning are environment-specific, so reserve setup time.

3. Demonstrate one feature across three versions

Use “Prepare training slides” as the same example task throughout the course. First create it through a Thymeleaf form, then create it through Postman JSON, then create it through React with Alice’s bearer token. At each stage, inspect the HTTP request and stored document.

For MVC, show the generated HTML and hidden CSRF field. For REST, show Content-Type, 201, Location, and the DTO. For JWT, show the request header and explain why decoding the payload does not establish trust. Finally attempt Alice’s id using Bob’s token and show 404.

When demonstrating code, follow controller → service → repository once, then return to the user-visible behavior. Learners should connect annotations to runtime behavior rather than memorize them in isolation.

4. Exercises and completion criteria

ExerciseAcceptance criteria
Add description to MVCDescription binds, validates to 500 characters, persists, and displays escaped.
Add completed filter to RESTGET filter returns only matching tasks; invalid query values are handled; existing CRUD still works.
Explain and prove ownershipBob cannot read, change, or delete Alice’s id; Alice’s data remains unchanged.
React usability extensionDisplay remaining token lifetime and friendly network feedback without persisting the token.
Optional paginationResponses are bounded, page inputs are validated, and personal queries keep ownerId.
Optional optimistic lockingTwo stale edits produce a conflict rather than silently replacing the latest change.

5. Assessment questions with answer notes

  1. What makes a class a Spring bean? Registration in the ApplicationContext through scanning, @Bean, or another supported registration mechanism.
  2. Why constructor injection? It makes required dependencies explicit and supports immutable references and isolated tests.
  3. What does Boot configure automatically? Infrastructure selected by dependencies, properties, and existing beans; it does not write business rules.
  4. Why use a request DTO? It restricts writable fields and separates API shape from storage.
  5. Why does @Valid matter? Constraints are metadata until a validation entry point evaluates them.
  6. How does Thymeleaf differ from React? Thymeleaf renders HTML on the backend; React renders the interactive interface in the browser.
  7. What is the difference between authentication and authorization? Identity verification versus deciding which resource operations are allowed.
  8. Is a JWT encrypted? This JWT is signed; header and payload are readable. The signature supplies integrity and authenticity.
  9. Why does a unique email index matter? Application checks alone can race; the database index enforces uniqueness.
  10. Does React logout revoke copied tokens? No. This lab clears local state; copied tokens remain usable until expiration.
  11. Why can Postman succeed when React fails? Browser CORS policy does not apply to Postman.
  12. Why must each personal query include ownerId? Hiding data in the UI is insufficient authorization.

6. Final demonstration rubric

A learner completes the program when they can run all projects, perform persistent CRUD, explain the Spring bean graph and request lifecycle, show correct REST status codes, demonstrate server validation, register and sign in, and prove two-user isolation. They should also state the JWT lifetime and logout limitations accurately.

Suggested grading: implementation and persistence 30%; request/response explanation 20%; validation and errors 15%; authentication and ownership 25%; clean setup and explanation of practical limits 10%.

Return to course index →

Prepared 7 October 2026 · Java 21 · Spring Boot 4.1.1 · MongoDB Atlas
All code blocks are complete files or explicitly labelled commands. No real credentials are included.