---
title: "Java & Spring Developer Beginner to Expert"
description: "An ordered path from Java syntax and the JVM through Spring dependency injection, Spring Boot, REST APIs, Spring Data JPA, Spring Security, testing, messaging, Spring Cloud, and deployment."
author: "Mohammad Abu Mattar"
canonical: https://mkabumattar.com/roadmaps/post/java-spring-developer-roadmap
---

# Java & Spring Developer Beginner to Expert

Almost everyone learning Spring learns it in the wrong order. They start with Boot, because Boot is the part that produces a running application quickly, and end up with a framework that works but cannot be reasoned about. The fix is boring: learn the Java underneath first, then learn the container, and only then the annotations.

_One request through a Spring Boot application, mapped to the stages that teach it_

Two topics in here are worth more than their position suggests.

Concurrency is in stage 3, and it's the one people skip hardest. A `@Service` is a singleton, so every request thread calls the same instance. Mutable field state in one is a race condition that will pass every test you write on your laptop and fail under load in a way that looks like a database problem.

And Spring AOP is in stage 5 because it explains the most confusing behaviour in the whole framework. `@Transactional` and `@Cacheable` work through a proxy the container wraps around your bean, which means calling an annotated method from another method of the same class bypasses the annotation entirely. People lose hours to that one, and it takes ten minutes to understand once you know proxies are involved.

Stages are ordered by dependency rather than by difficulty. Topics marked required are the ones you'll be asked about and the ones you'll debug; recommended and optional can wait until a real project asks for them.

## Roadmap

### Stage 1: Java language foundations

The part people skip, and the reason Spring later feels like magic rather than a library. Target Java 21 or a later LTS.

#### Syntax, types, and control flow

Primitives against their boxed wrappers, the difference between `==` and `equals`, string immutability, and why `switch` expressions and pattern matching in modern Java remove most of the verbosity people still associate with the language.

- [Dev.java, the official Java learning site](https://dev.java/learn/)

#### Classes, interfaces, and records

Encapsulation, inheritance and composition, plus records for immutable data carriers. A record replaces about forty lines of getters, `equals`, `hashCode` and `toString`, and it is the right default for a DTO.

#### What the JVM actually does

Compilation to bytecode, class loading, the heap against the stack, and garbage collection at a conceptual level. You do not need to tune a collector yet, but you do need to know that an `OutOfMemoryError` and a `StackOverflowError` have different causes.

#### Interfaces with default methods, sealed types _(recommended)_

Default methods are how the standard library evolved without breaking implementers, and sealed interfaces let you close a hierarchy so pattern matching can be exhaustive. Both show up in modern framework code.

### Stage 2: Collections, generics, and streams

You cannot read a Spring method signature without generics, and you cannot write idiomatic service code without streams.

#### The collections framework

`List`, `Set`, `Map`, `Deque`, and which implementation to choose. `ArrayList` against `LinkedList` in practice, `HashMap` against `TreeMap` against `LinkedHashMap`, and the contract between `equals` and `hashCode` that makes a `HashSet` work at all.

#### Generics, bounded types, and wildcards

Type parameters, `extends` and `super` bounds, and why `List<? extends Number>` is read-only. Type erasure explains most generics error messages, including why you cannot write `new T[]`.

#### Streams and collectors

`map`, `filter`, `flatMap`, `reduce`, and `Collectors.groupingBy`. Streams are lazy until a terminal operation runs, and a stream is single-use. Reach for a loop when the stream version is harder to read, which happens more often than stream enthusiasts admit.

#### Optional, used properly

Spring Data returns `Optional`, so this matters immediately. Use `map`, `filter` and `orElseThrow`; calling `.get()` without checking defeats the entire purpose. Optional is for return values, not for fields or parameters.

- [Java Optional: the official API documentation](https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/Optional.html)

### Stage 3: Exceptions and concurrency

The stage that separates people who can debug a production Spring application from people who cannot.

#### Checked against unchecked exceptions

When to use each, and why Spring wraps checked JDBC exceptions in unchecked `DataAccessException` subclasses. Never swallow an exception silently, and never catch `Exception` to make a compiler complaint go away.

#### try-with-resources

Any `AutoCloseable` is closed automatically, in reverse order, including when the body throws. It is the correct way to handle a stream, a connection or a file, and it removes an entire class of resource leak.

#### Threads, and why a Spring bean is shared

The single most important concurrency fact for a Spring developer: a `@Service` is a singleton, and every request thread calls the same instance. Mutable field state in one is a race condition that passes every test on your machine and fails under load.

#### The concurrency toolkit

`ExecutorService`, `CompletableFuture`, `AtomicInteger`, `ConcurrentHashMap`, and the `synchronized` keyword. Prefer immutability and the concurrent collections over hand-written locking.

#### Virtual threads _(recommended)_

Project Loom, stable since Java 21. A blocking call on a virtual thread no longer ties up an OS thread, which changes the calculus for thread-per-request web applications and is why Spring Boot 3.2 can turn them on with one property.

- [JEP 444: Virtual Threads](https://openjdk.org/jeps/444)

### Stage 4: Build tools and project layout

Short stage, but everything after it assumes you can add a dependency and read a build failure.

#### Maven fundamentals

The POM, the build lifecycle, dependency scopes, and transitive resolution. `mvn dependency:tree` is the command that resolves most version conflicts, and knowing that the nearest definition wins explains the ones it does not.

#### Gradle fundamentals _(recommended)_

The alternative, with a Kotlin or Groovy DSL and better incremental build performance. Worth being able to read even if your team uses Maven, because a lot of library documentation assumes it.

#### Spring Boot starters and dependency management

A starter is a curated set of dependencies with versions already reconciled. This is why you add `spring-boot-starter-web` without a version and why overriding one Spring version by hand usually breaks something else.

### Stage 5: Spring core and dependency injection

The conceptual centre of the whole ecosystem. Learn the container before you learn the annotations, or every later stage will feel like magic.

#### Inversion of control and the application context

Your code stops constructing its collaborators and declares what it needs instead. The container builds the object graph and hands dependencies in. Every annotation you learn later is a way of describing something to this container.

- [Spring Framework: the IoC container](https://docs.spring.io/spring-framework/reference/core/beans.html)

#### Beans, scopes, and lifecycle

Singleton by default, plus prototype and request scopes. `@PostConstruct` and `@PreDestroy` hooks, and why a singleton depending on a request-scoped bean needs a proxy.

#### Constructor injection, and why not field injection

Constructor injection makes dependencies explicit, allows `final` fields, fails fast on a missing bean, and lets you build the object in a unit test without a container. Field injection with `@Autowired` does none of that. Prefer constructors, always.

#### Component scanning and configuration

`@Component`, `@Service`, `@Repository` and `@Controller` are all component stereotypes with different semantic intent. `@Configuration` with `@Bean` methods is how you register something you do not own the source of.

#### Spring AOP and proxies

How `@Transactional`, `@Cacheable` and `@Async` actually work: the container hands you a proxy that wraps your bean. This explains the single most confusing Spring behaviour, that calling an annotated method from another method of the same class bypasses the annotation entirely.

### Stage 6: Spring Boot fundamentals

Boot is Spring with the configuration decided for you. Knowing what it decided is the difference between using it and fighting it.

#### Auto-configuration, and how to see it

Boot configures beans based on what is on the classpath, and backs off when you define your own. Run with `--debug` for the auto-configuration report showing every decision and its reason. This turns Boot from magic into something you can reason about.

#### Configuration properties and profiles

`application.yml`, `@ConfigurationProperties` for type-safe binding with validation, and profiles for per-environment values. Learn the property resolution order, because an environment variable silently overriding your YAML is a confusing hour otherwise.

#### The embedded server

Tomcat by default, with Jetty and Undertow as alternatives. Your application is a jar that starts a server rather than a war deployed into one, which is what makes containerising it straightforward.

#### Spring Boot DevTools _(optional)_

Automatic restart on classpath change and sensible development defaults. A small quality-of-life gain that shortens the feedback loop.

### Stage 7: REST APIs with Spring MVC

The layer most of your work happens in, and the layer where design decisions age badly if you get them wrong early.

#### Controllers and request mapping

`@RestController`, `@GetMapping` and friends, `@PathVariable`, `@RequestParam`, `@RequestBody`. Return an object and let Jackson serialise it rather than building JSON by hand.

#### DTOs, and why entities do not belong in a response

Returning a JPA entity from a controller couples your API to your schema, leaks fields you did not mean to expose, and triggers lazy-loading exceptions during serialisation. Map to a record. This is the single most valuable habit in this stage.

#### Validation with Bean Validation

`@Valid` on the parameter plus `@NotNull`, `@Size`, `@Email` and custom constraints on the DTO. Validation belongs at the boundary, so invalid input never reaches your service layer.

#### Global exception handling

`@RestControllerAdvice` with `@ExceptionHandler` methods, returning a consistent error shape. Follow RFC 9457 problem details, which Spring 6 supports natively, rather than inventing your own error envelope.

- [RFC 9457: Problem Details for HTTP APIs](https://www.rfc-editor.org/rfc/rfc9457)

#### API documentation with OpenAPI _(recommended)_

springdoc-openapi generates a specification and a Swagger UI from your controllers and DTOs. Generated documentation stays accurate; hand-written documentation does not.

#### Pagination and sorting

`Pageable` and `Page` in a controller signature, wired straight through to Spring Data. Any endpoint returning a collection needs this before it reaches production, not after a customer with 40,000 rows finds it.

### Stage 8: Data access with Spring Data JPA and Hibernate

The stage with the most expensive mistakes. Spring Data is easy; Hibernate is not, and pretending otherwise is how N+1 queries reach production.

#### Entities, mappings, and relationships

`@Entity`, `@Id`, generation strategies, and `@OneToMany`, `@ManyToOne`, `@ManyToMany` with their owning side. Default to `FetchType.LAZY` on every association, because `EAGER` loads a graph you did not ask for on every query.

#### Repositories and derived queries

Extend `JpaRepository` and Spring generates the implementation. Method-name derivation such as `findByEmailAndActiveTrue`, with `@Query` for JPQL when a name would become unreadable.

#### The N+1 query problem

Loading 100 orders and then a customer for each is 101 queries. Fix it with a `JOIN FETCH`, an `@EntityGraph`, or a projection that selects only what you need. Turn on SQL logging and count your queries; almost every slow endpoint is this.

- [Hibernate: fetching strategies](https://docs.jboss.org/hibernate/orm/current/userguide/html_single/Hibernate_User_Guide.html#fetching)

#### Transactions and propagation

`@Transactional` belongs on the service, because the transaction boundary is a business decision rather than a persistence detail. Understand propagation and the default rollback rule, which rolls back on an unchecked exception and, surprisingly, not on a checked one.

#### The persistence context and lazy loading

Entities are managed inside a transaction and detached outside it, which is why touching a lazy collection in a controller throws `LazyInitializationException`. Fetch what you need inside the boundary and map to a DTO before leaving it.

#### Schema migrations with Flyway or Liquibase

`ddl-auto` is a development convenience and a production hazard. Versioned migration scripts in source control are the only defensible way to evolve a schema, and Boot runs them at startup.

#### Projections and native queries _(recommended)_

An interface or record projection selects only the columns you need, which is often a large win over loading full entities. Drop to a native query when JPQL cannot express what the database can, and accept the loss of portability.

### Stage 9: Spring Security

The steepest learning curve in the ecosystem, mostly because it operates before your code runs and the failures are therefore silent from your perspective.

#### The filter chain

Security is a chain of servlet filters that runs before your controller, which is why an unauthorised request never reaches your code and why you cannot debug it by adding logging there. Learn to read the chain, and use `logging.level.org.springframework.security=DEBUG`.

- [Spring Security: architecture](https://docs.spring.io/spring-security/reference/servlet/architecture.html)

#### Authentication and authorisation

Authentication establishes identity; authorisation decides what that identity may do. `SecurityFilterChain` configuration, `@PreAuthorize` for method-level rules, and the difference between a role and an authority.

#### Password storage

`PasswordEncoder` with bcrypt or Argon2, and `DelegatingPasswordEncoder` so stored hashes carry their algorithm prefix and can be migrated. Never store a password reversibly, and never write your own hashing.

#### JWT and stateless authentication

Issuing and validating tokens, choosing an expiry, and the refresh-token pattern. Understand what a JWT cannot do: you cannot revoke one before it expires without server-side state, which is the tradeoff people discover too late.

#### OAuth2 and OpenID Connect

Spring Security as a resource server validating tokens, and as a client performing a login flow. The authorisation code flow with PKCE is the correct choice for a browser or mobile client; the implicit flow is deprecated.

#### CSRF, CORS, and the security headers

When CSRF protection is needed and when it is not, why a stateless token API usually disables it, and how CORS differs from it entirely despite being confused with it constantly. Set the standard headers, including a content security policy.

### Stage 10: Testing

Ninth in the ordering because this is when you know enough to test properly. In practice it belongs beside every stage after it.

#### JUnit 5 and AssertJ

Lifecycle annotations, parameterised tests, and nested test classes. AssertJ's fluent assertions produce failure messages you can read, which matters more than it sounds when a test fails in CI at 6pm.

#### Mockito, and what not to mock

`@Mock`, `@InjectMocks`, stubbing and verification. Mock the collaborators at your boundaries, not everything: a test that mocks five things and asserts on the interactions tests your mocks rather than your logic.

#### Slice tests against full context tests

`@WebMvcTest` loads only the web layer, `@DataJpaTest` only persistence. Both start far faster than `@SpringBootTest`, which loads everything. Reach for the full context only when the test genuinely spans the application.

#### Testcontainers

A real PostgreSQL, Kafka or Redis in Docker for the duration of the test. It ends the class of bug that only appears against the real database, and it is now the default recommendation over an in-memory substitute.

- [Testcontainers for Java](https://java.testcontainers.org/)

#### Integration testing an API _(recommended)_

`MockMvc` for the servlet layer without a network, `WebTestClient` or `TestRestTemplate` against a running port. Test the contract, including error responses and validation failures, since those are what break for callers.

### Stage 11: Messaging, caching, and performance

What you add when one synchronous request can no longer do all the work, or should not.

#### Asynchronous messaging with Kafka

Producers, consumers, topics, partitions and consumer groups through Spring for Apache Kafka. Delivery is at-least-once, so a consumer must be idempotent. That requirement is the whole design problem, not a detail.

#### RabbitMQ and Spring AMQP _(recommended)_

The alternative model: exchanges, queues and bindings, with per-message acknowledgement. A better fit than Kafka for task queues and request-reply, and a worse fit for a replayable event log.

#### Caching with Spring Cache

`@Cacheable`, `@CachePut` and `@CacheEvict` over Redis or Caffeine. The annotations are trivial; the difficulty is invalidation and choosing a TTL. Remember that the proxy means an internal method call skips the cache entirely.

#### Connection pooling

HikariCP is the Boot default. Pool sizing is the most commonly misconfigured performance setting in Spring applications, and a bigger pool is usually slower. Match it to what the database can actually serve concurrently.

#### Async and scheduled work _(recommended)_

`@Async` for fire-and-forget with an explicit executor, `@Scheduled` for periodic tasks. Never rely on the default executor in production, and remember `@Scheduled` runs on every instance unless you add coordination.

#### JVM tuning and profiling _(optional)_

Heap sizing, choosing a collector, and reading a heap dump. Learn one profiler properly: async-profiler or JDK Flight Recorder. Measuring first is the difference between a fix and a guess.

### Stage 12: Microservices, observability, and deployment

The stage to reach for only when a single deployable genuinely stops working. Most applications never need it.

#### When not to split

A well-structured monolith beats a distributed system you did not need, because a network call between modules turns a compile error into a runtime one and a stack trace into a correlation-ID hunt. Split for independent deployment and scaling, not for tidiness.

#### Spring Cloud fundamentals _(recommended)_

Service discovery, centralised configuration, and an API gateway with Spring Cloud Gateway. Understand what each one buys you before adopting it, because each is also a component that can fail.

#### Resilience patterns

Circuit breakers, retries with backoff, timeouts and bulkheads through Resilience4j. A retry without a backoff and a jitter is an accidental denial of service against your own dependency.

#### Actuator and metrics

`/actuator/health` for readiness and liveness probes, and Micrometer publishing to Prometheus. Expose the endpoints you need on a separate port, and never expose them all publicly.

- [Spring Boot Actuator: production-ready features](https://docs.spring.io/spring-boot/reference/actuator/index.html)

#### Distributed tracing and structured logging

Micrometer Tracing propagating a trace ID across services, with logs emitted as JSON carrying that ID. Without this, debugging across services means correlating timestamps by hand.

#### Containerising a Spring Boot application

Layered jars or Cloud Native Buildpacks via `mvn spring-boot:build-image`, so a code change does not invalidate the dependency layer. Handle SIGTERM by enabling graceful shutdown, and set container-aware heap limits.

#### CI/CD and deployment

Build, test and image publishing in a pipeline, then a rolling deploy to Kubernetes or a managed platform. Configuration through environment variables and secrets from a real secret store rather than a file in the image.

#### Native images with GraalVM _(optional)_

Ahead-of-time compilation for startup in milliseconds and much lower memory, at the cost of longer builds and reflection configuration. Worth it for serverless or heavy horizontal scaling, and unnecessary for a long-running service.
