Skip to content
Shipped Code cover card with the title Java backend roadmap: core Java to production Spring Boot

Java backend roadmap: core Java to production Spring Boot

Table of Contents
  1. Which versions to learn
  2. Stage 1: Modern core Java
  3. Stage 2: Build tool
  4. Stage 3: A Spring Boot REST API
  5. Stage 4: Persistence
  6. Stage 5: Security and tests
  7. Stage 6: Production
  8. What to skip for now
  9. Configuring the service to run well in production
  10. Which post to read first

Many Java backend roadmaps list dozens of tools and leave you to guess the order. This one has 6 stages, and each stage ends with a test you can run on yourself before moving on.

TL;DR. Learn modern core Java first, then a build tool, then a Spring Boot REST API with validation and consistent errors. After that come persistence (JPA, transactions, Flyway), then security and integration tests, and only then production concerns like Docker, metrics and caching. Skip application servers, XML config, microservices and Kubernetes until one well-tested Spring Boot service runs in production. For a new project in late 2026, that means Spring Boot 4.x on Java 21 or 25.

The 6 stages, in order:

  1. Modern core Java: collections, streams, records, sealed types, enough concurrency not to fear it.
  2. Build tool: Maven or Gradle, well enough to build and test from the command line.
  3. A Spring Boot REST API: controllers, validation, ProblemDetail errors, configuration.
  4. Persistence: JPA, the N+1 problem, @Transactional, Flyway migrations.
  5. Security and tests: JWT for a mobile client, integration tests on a real database.
  6. Production: Docker, health checks, metrics, structured logs, caching.

This roadmap is for you if you already know basic Java or Kotlin syntax, including Android developers who want to learn Spring Boot after Java or Kotlin to write their app’s backend. If you are short on time, read the stage list above and the section What to skip for now. Each stage section says what “done” looks like and which post on this site goes deeper.

Java backend roadmap as a top-to-bottom path: modern core Java, build tool, Spring Boot REST API, persistence, security and tests, production. Persistence links to the database pillar and production links to the DevOps pillar.

Which versions to learn

Learn on Spring Boot 4.x and Java 21 or 25. The Spring Boot 3.x line is out of open-source support. According to the Spring Boot support table, open-source support for 3.5 ended on 30 June 2026, and only paid commercial support continues. start.spring.io now generates 4.0, 4.1 and 4.2 projects only. Spring Boot 4.2.0 is the current release, and its system requirements say it needs Java 17 or later and works up to Java 27.

On the Java side, the Oracle support roadmap lists Java 21 and Java 25 as the current LTS releases, with premier support until September 2028 and September 2030. Pick Java 25 for a new project unless your hosting platform or company standard pins you to 21. Nothing in this roadmap depends on the difference. The next LTS, Java 29, is planned for September 2027. Move from one LTS to the next once your Spring Boot version supports it, and skip the 6-month releases in between.

You will still find many tutorials written for Spring Boot 3, and some earlier code on this site runs on Spring Boot 3.5 and Java 21. The concepts carry over. What changes most often is setup detail. A new 4.x project, for example, uses spring-boot-starter-webmvc where 3.x tutorials say spring-boot-starter-web.

Stage 1: Modern core Java

Backend Java code today is mostly collections, streams and small immutable data types, so that is where to spend your time. You need:

  • List, Set and Map, and which implementation to pick (ArrayList, HashSet, HashMap, LinkedHashMap, TreeMap);
  • streams and Optional, including when a plain loop reads better;
  • records, sealed interfaces and pattern matching in switch;
  • enough concurrency to know what a thread pool is, why shared mutable state is dangerous, and what CompletableFuture is for.

You can skip GUI libraries (Swing, JavaFX), applets, and the details of the class loader and garbage collector for now.

Here is a quick self-check. The file below runs as-is with java Stage1Check.java on Java 21 or later, with no build tool needed. If you can read it without looking anything up, and predict the output, stage 1 is done.

Stage1Check.java
import java.util.*;
import static java.util.stream.Collectors.*;
public class Stage1Check {
sealed interface Payment permits Card, Wallet, Failed { String userId(); }
record Card(String userId, long cents) implements Payment {}
record Wallet(String userId, long cents) implements Payment {}
record Failed(String userId, String reason) implements Payment {}
static String describe(Payment p) {
return switch (p) {
case Card c when c.cents() > 100_000 -> "large card payment";
case Card c -> "card";
case Wallet w -> "wallet";
case Failed f -> "failed: " + f.reason();
};
}
static long cents(Payment p) {
return switch (p) {
case Card c -> c.cents();
case Wallet w -> w.cents();
case Failed f -> 0;
};
}
public static void main(String[] args) {
List<Payment> payments = List.of(
new Card("u1", 2_500), new Wallet("u2", 900),
new Card("u1", 150_000), new Failed("u3", "card declined"));
payments.forEach(p -> System.out.println(describe(p)));
Map<String, Long> centsByUser = payments.stream()
.filter(p -> !(p instanceof Failed))
.collect(groupingBy(Payment::userId, TreeMap::new, summingLong(Stage1Check::cents)));
System.out.println(centsByUser);
}
}
Java
card
wallet
large card payment
failed: card declined
{u1=152500, u2=900}

The check comes with 2 questions. Why does the map print u1 before u2 every time? (TreeMap keeps its keys sorted; a HashMap makes no promise about order.) And what happens if you delete the line case Failed f -> 0;? I tried it, and the file no longer compiles:

Stage1Check.java:20: error: the switch expression does not cover all possible input values

That error is the reason sealed types are worth learning. When someone adds a new kind of payment, the compiler lists every switch that has to handle it.

You can leave this stage when you can pick a collection for a task and explain why. You should also be able to read stream and switch code like the file above without help.

In the “Modern Java foundations” series:

  • Java collections for backend developers: choosing List, Set and Map
  • Java Stream API and Optional: patterns to keep and traps to avoid
  • Records, sealed interfaces and pattern matching in Java 21+ backend code
  • Java books I would still buy after 10 years of backend work

Stage 2: Build tool

You need one build tool well enough to add a dependency, run the tests and build a runnable jar from the command line. If you come from Android, you already know Gradle, so keep using it. Everyone else should start with Maven, because a pom.xml is declarative and offers fewer ways to do the same thing. You are done with this stage when you can explain where a dependency’s version comes from (the Spring Boot parent or BOM). You should also be able to run ./mvnw verify or ./gradlew build without an IDE.

Stage 3: A Spring Boot REST API

The Spring Boot part of the roadmap starts here, and this is the stage where you build something a client app can call. Write a small CRUD API and learn these pieces on the way:

  • @RestController, request mapping, and separate request/response DTOs instead of exposing entities;
  • Bean Validation (@Valid, @NotBlank, @Size) on request bodies;
  • errors in one shape, using ProblemDetail (the RFC 9457 format Spring supports out of the box);
  • configuration from application.yaml, environment variables and @ConfigurationProperties, with profiles for local and production.

You are done when invalid input returns a 400 with the same JSON shape on every endpoint, and no response ever contains a stack trace. The database URL and secrets come from the environment.

Posts in this stage:

  • Consistent API errors in Spring Boot with ProblemDetail and Bean Validation

Stage 4: Persistence

Many of the bugs that only appear with real data start in this stage. Learn JPA entities and Spring Data repositories, then the parts that bite:

  • lazy loading and the N+1 query problem, where one list endpoint quietly sends one SQL query per row;
  • where a transaction starts and ends, and why @Transactional is ignored when another method in the same class calls it;
  • schema changes as versioned Flyway migrations, with Hibernate set to ddl-auto: validate so it checks the schema and never changes it.

You are done when you can predict the SQL a repository call sends, and then confirm it by turning on SQL logging.

The SQL and indexing you need day to day belong to the database pillar.

Posts in this stage:

  • Spring Data JPA N+1 queries: find them, fix them, test them
  • @Transactional pitfalls: self-invocation, rollback rules, propagation
  • Zero-downtime schema migrations with Flyway

Stage 5: Security and tests

A backend for a mobile app usually authenticates with tokens. In practice, you need Spring Security’s filter chain, hashed passwords and a short-lived access token, often a JWT. A refresh token lets the app get a new access token without asking the user to log in again. The server can trust a token’s claims only after it has checked the signature and the expiry.

For tests, learn the difference between slice tests (@WebMvcTest, @DataJpaTest) and full @SpringBootTest runs. Then run your integration tests against the same database you use in production, started by Testcontainers. An in-memory H2 database accepts SQL that PostgreSQL rejects, and the reverse, so green H2 tests prove less than they seem to.

Before moving on, make sure CI runs at least one integration test per endpoint against a real database. The tests should check the 401 and 403 cases as well as the happy path.

Posts in this stage:

  • JWT authentication for a mobile app backend with Spring Security
  • Integration tests with Testcontainers in Spring Boot

Stage 6: Production

Production work starts once the service is correct and tested. Package it as a Docker image, then make it observable with Actuator health checks, Micrometer metrics and structured logs. Add caching only where you have measured a slow, repeated read, because every cache brings an invalidation problem with it.

Virtual threads also belong here. Spring Boot turns them on with one property, spring.threads.virtual.enabled=true, and they mainly help services that spend most of their time waiting on I/O. Learn them after the basics, and measure before and after.

If you need to run several remote calls in parallel and combine the results, read CompletableFuture in practice: composing async calls without callback hell.

Deployment, CI/CD and servers get their own pillar, DevOps for app developers.

Posts in this stage:

  • Caching in Spring Boot with Redis: what to cache and when to evict
  • Observability for Spring Boot: Actuator, Micrometer, Prometheus
  • Virtual threads in Spring Boot: a benchmark and when they help

What to skip for now

Each of these costs weeks, and each makes more sense after you have shipped one service.

  • Application servers and Jakarta EE deployment (WAR files on WildFly or WebLogic) can wait, because Spring Boot embeds Tomcat and runs as a plain jar. That is also why this roadmap uses Spring Boot rather than Jakarta EE, Quarkus or Micronaut: it is the most widely used Java backend framework, so help is easy to find, and the concepts transfer if you switch later.
  • XML bean configuration is something you will mostly meet in old codebases, and you can read it when that day comes.
  • Writing custom auto-configuration or studying how AOP proxies are built can wait. Knowing that @Transactional works through a proxy is enough for stage 4.
  • Reactive programming with WebFlux changes how you write every layer, and virtual threads now cover much of the “many concurrent waiting requests” case. Learn it when a project needs it.
  • Microservices, Spring Cloud, Kafka and Kubernetes solve problems of many teams and many services. One service with one database does not have those problems yet.

Warning: The most expensive mistake on this roadmap is starting with microservices. You pay for network calls, distributed transactions and deployment of several services before you can build and test one. Splitting a well-structured monolith later is ordinary refactoring work; merging services back is rarely done.

Configuring the service to run well in production

When a service that works on a laptop fails its first production deployment, the cause is often one of a few things. Configuration or secrets are baked into the jar. Hibernate changes the schema on its own. The connection pool doesn’t match what the database allows. Nobody can tell whether the service is healthy, and its logs can’t be searched.

The configuration below covers those points for a Spring Boot 4.2 service with PostgreSQL. It assumes the starters for web MVC, data JPA, Flyway and Actuator, plus micrometer-registry-prometheus.

application.yaml
spring:
datasource:
url: ${DB_URL}
username: ${DB_USER}
password: ${DB_PASSWORD}
hikari:
maximum-pool-size: ${DB_POOL_SIZE:10}
jpa:
hibernate:
ddl-auto: validate
open-in-view: false
management:
endpoints:
web:
exposure:
include: health,info,prometheus
endpoint:
health:
probes:
enabled: true
logging:
structured:
format:
console: ecs
YAML

Each block answers one of those failures. The datasource reads its URL and credentials from environment variables, so the same jar runs in every environment. ddl-auto: validate makes Hibernate check the schema that Flyway created instead of changing it. open-in-view: false closes the persistence context when the service method returns, so lazy loading in a controller fails loudly instead of sending hidden queries. The health probes and the Prometheus endpoint tell a load balancer or a monitoring system whether the service is alive, and the ecs format writes each log line as JSON that a log tool can search.

With a first migration in src/main/resources/db/migration/V1__create_note.sql, the service starts, applies the migration and answers on the health endpoint:

Successfully applied 1 migration to schema "public", now at version v1
{"groups":["liveness","readiness"],"status":"UP"}
JSON

This setup has 3 details that can cost you an afternoon, and I ran into each of them on Spring Boot 4.2.0.

  • Listing prometheus in exposure.include is not enough. Without the micrometer-registry-prometheus dependency, /actuator/prometheus returns 404 and the startup log says it exposes only 2 endpoints. With the dependency it returns metrics, including hikaricp_connections_max{pool="HikariPool-1"} 10.0.
  • In Spring Boot 4, flyway-core alone does not run migrations. I replaced spring-boot-starter-flyway with org.flywaydb:flyway-core, as many 3.x tutorials show. Nothing migrated, and ddl-auto: validate stopped the start with Schema validation: missing table [note]. That failure is the reason to keep validate on, because it catches the problem at startup and not on the first request.
  • A missing environment variable does not fail with a clear message. Without DB_PASSWORD, Spring did not complain about the placeholder. The app started, Flyway tried to connect, and the error was password authentication failed for user. When that error shows up in a new environment, check the variables before the database.

The pool size of 10 is HikariCP’s default, written out so you can change it per environment. The number that matters is the total. Multiply the pool size by the number of service instances, and keep the result below the database’s connection limit, with room left for migrations and admin tools.

Which post to read first

If you are starting stage 1 now, the next post to read is Java collections for backend developers: choosing List, Set and Map.

Series on this site. “Modern Java foundations” (4 posts) covers stage 1. “Spring Boot in production” (10 posts) covers stages 3 to 6 (N+1 queries, @Transactional pitfalls, ProblemDetail errors, JWT for mobile apps, Testcontainers, Redis caching, observability, virtual threads), plus IDE setup and a learning path. Posts are added weekly; published ones appear under Java.

Tag:#Java#Spring boot