Learn Spring Security
Guide to the real code · Java 21 + Spring Boot 3.5.16 · React + MySQL
From a login form
to a protected API.
Learn to recognise each component, follow a request and run the lab. This documentation describes the repository implementation, with configuration examples and a full Docker deployment.
What you can do with this application
Any visitor can register as USER and sign in. USER and ADMIN can access their welcome page, profile and educational explanation. ADMIN manages accounts: list, search, create, edit name/email, change password/role, enable, disable and delete users.
The Users screen searches the list in React by name or email. The server delivers the full list ordered by id: no HTTP search or pagination.
One request, five responsibilities
React displays forms and sends HTTP. Spring Security decides who may enter. Controllers receive data; the service applies CRUD rules; JPA queries or saves entities using HikariCP pooled connections.
Learning path
- Start the project and sign in as USER. Observe login and
/api/me. - Reload: you must sign in again because the JWT lives in memory.
- Sign in as ADMIN and create an account. Inspect the POST, its JSON and status 201.
- Use another browser profile for USER. Change its role as ADMIN and observe the next request.
- Try a tampered token, duplicate email and short password. Relate each response to its layer.
- Read the diagrams with Java files open and follow full deployment using the single root compose.yml.
How to use this documentation
Open docs/html/index.html directly in the browser. All pages, styles and diagrams work offline without installing packages. Code links are relative to the repository; depending on the browser, files open or download. Print each chapter using the top button.
Project sources: flow guide, HTTP requests and README. Official external references appear in the relevant chapters.