A Spring Backend Learning Roadmap: Seven Skills to Demonstrate with a Small Service
If you have finished a course but still struggle to build a feature independently, try connecting one small service end to end before expanding the technology list. Practice receiving requests, storing data, handling failures, checking permissions, and diagnosing slow operations in the same codebase.
This article proposes a learning plan built around a fictional reading-log service. It is not an account of an implementation already completed, nor a promise to become an intermediate developer within a fixed period. The goal is to explain your code's behavior and reproduce failures.
Define the practice service
Users can register books and change reading status. Each status change also creates a history record. Only the owner can modify an entry, and lists support sorting and pagination.
Two example tables are enough to start.
| Table | Main columns | Role |
|---|---|---|
reading_entry | id, owner_id, title, status, created_at | Current reading entry |
reading_event | id, entry_id, from_status, to_status, created_at | Status-change history |
Use WANT_TO_READ, READING, and FINISHED as states. Initially simplify the rules to forward transitions only. This is a learning choice that can be changed for a real service.
1. Check business rules without Spring
Start with functions that reject blank titles and accept only allowed state transitions. Inputs and outputs can be tested without HTTP or a database.
| Input | Expected behavior |
|---|---|
| Registration with a whitespace-only title | Reject |
| Want to read → reading | Allow |
| Reading → finished | Allow |
| Want to read → finished | Reject under this exercise's rules |
| Finished → reading | Reject under this exercise's rules |
Completion means having tests that distinguish rejection reasons as well as a successful case. Learn the Java classes, collections, and exceptions needed along the way. Do not make mastering every language feature a prerequisite to starting.
2. Connect HTTP requests to business rules
The following API contract is proposed for the exercise.
| Request | Intended response |
|---|---|
POST /reading-entries | 201 on creation, with resource location and body |
GET /reading-entries/{id} | 200 if found; otherwise 404 |
PATCH /reading-entries/{id}/status | 200 on change; 409 for a disallowed transition |
| Create with a blank title | 400, with field and error code |
For example, a status-change request is {"status":"READING"}. Also define repeated requests for the same state. This plan proposes treating them as successful retries without adding another history event.
Let the controller handle HTTP formats and error responses, and the service execute business rules. Follow constructor dependencies wired by Spring in the debugger, and inspect the startup error when a required bean is missing. The Spring REST guide provides a starting point for request handling and JSON responses.
Completion means sending the documented requests and observing the specified status codes and responses. Record which input produces which outcome rather than simply saying that the API works.
3. Check database constraints and transactions
Replace the in-memory store with a relational database. Manage required-title constraints, history foreign keys, and necessary indexes through schema migrations. Inspect actual SQL and tables alongside JPA methods.
The representative task is to make the status update and history insert one operation. A service can define a transaction boundary around multiple persistence operations. Spring Data JPA transaction guide
Use this verification scenario:
- Prepare an entry in
WANT_TO_READstate. - Change it to
READINGthrough a service call on an actual Spring bean. - Within the same transaction, raise a test
RuntimeExceptionimmediately before inserting the history event. - After the call fails, query again in a separate transaction.
- Verify that the original state remains and no history event was added.
Inspect database state after the service transaction has ended so that a test method's automatic rollback does not make the service appear correct. Default rollback rules depend on exception type; do not assume checked exceptions behave identically. Spring rollback rules
4. Test authentication and ownership separately
Prepare users A and B, then compare access to an entry created by A. This learning plan chooses 401 for unauthenticated requests to protected APIs and 403 for authenticated users attempting to modify someone else's entry. Specify and test the service's error-response policy.
| Requester | Modify A's entry | What to check |
|---|---|---|
| Unauthenticated | Reject | Is the request blocked before business data changes? |
| User B | Reject | Does ownership checking still apply when the requested ID changes? |
| User A | Allow | Are business rules applied after permission checks? |
Being authenticated does not grant permission to modify every entry. Also check that rejected requests leave the database unchanged. This table specifies behavior to practice; passing it does not verify the application's entire security posture.
5. Compare list queries using data
Use deterministic ordering that resolves ties, such as created_at DESC, id DESC. Insert entries with identical creation times, then check for duplicates or omissions while paging through a static dataset. Define consistency during concurrent inserts separately.
Next add sufficient test data and inspect the SQL and execution plan for one user's list. Compare before and after adding an index with the same inputs and conditions. Index use alone does not establish an improvement.
PostgreSQL's EXPLAIN shows a plan; EXPLAIN ANALYZE actually executes the query. Practice with read queries on a test database. PostgreSQL execution-plan guide
The deliverable is the SQL, data volume, plan, measurement conditions, and before-and-after observations. Preserve results even if performance does not improve. There is no need to invent a target duration or improvement percentage.
6. Choose a test scope that answers the question
Review the tests from earlier stages by purpose.
| Question | Suitable starting scope |
|---|---|
| Are state-transition rules correct? | Unit tests without Spring |
| Do invalid requests produce the promised responses? | Web-layer tests |
| Do constraints, queries, and rollback work on the actual database? | Integration tests using that database |
| Does ownership rejection prevent data changes? | Security and business-flow integration tests |
| Does the core flow work in a fresh environment? | A small number of end-to-end tests |
Rather than counting tests, check whether the necessary test fails when the implementation is made incorrect. For example, if the rollback test still passes after removing the transaction boundary around status and history updates, revisit what that test actually exercises.
7. Start in another environment and diagnose problems
Document how to run migrations on an empty test database and start the built application. Supply secrets through environment-specific configuration instead of placing them in code. Record the startup command, required configuration names, and a request used to check health.
Actuator can provide health information and operational metrics. Decide which endpoints to expose and who may access them, and check that unnecessary configuration or environment information is not public. Actuator endpoint guide
Disconnect the database in a test environment and observe changes in request failures, logs, and health signals. Include an identifier that connects a request to its logs, but do not print tokens or secrets.
Completion means being able to start the service from a fresh working directory using only the documentation, and to explain one failed request by connecting its response with the logs.
Choose the next topic from behavior you cannot yet explain
Once creation and retrieval work, inspect rollback after failed changes. Once rollback works, inspect ownership; once ownership is correct, inspect actual query costs. Choose the next behavior you cannot demonstrate rather than following a weekly quota.
When a problem appears, briefly record the symptom, expectation, evidence, change, and recheck result. This record does not guarantee learning outcomes; it is working material that helps avoid investigating the same problem from scratch later.
For a separate concrete HTTP exercise, see the Spring Boot Jackson configuration comparison. It illustrates comparing requests and responses, not an already completed implementation of this roadmap's reading-log service.
Report an error or share feedback
Open a draft with this article’s title and URL. Review the message and recipient before sending.
Open email draftIf no email app opens, copy these details into your usual email service.
Related posts
Backend & Infrastructure Three Production Problems Local Tests Missed
Flyway never ran, npm failed inside Docker, and cache writes failed on permissions. Local tests missed each problem.
Backend & Infrastructure The App Started Without Its Category Column: Moving from ddl-auto=update to Flyway
A category change left the app running without a required column. I rebuilt the early database, then moved schema changes to Flyway.