Chapter 1.8☕ 14 min read

Spring Boot 3 Jakarta Migration

Spring Boot 3 is not just an upgrade — it's a new foundation.

01The Concept: Java EE to Jakarta EE

The Hyderabad RTC to Metro Express Analogy:

For years, Hyderabad used the old RTC buses to get around. They worked, but they were slow and outdated. The government decided to completely overhaul the system and introduce the Hyderabad Metro Express. The route is exactly the same (Point A to Point B), but the underlying engine and branding completely changed.

In the Java world, Java EE (Enterprise Edition) was the old RTC bus. It was controlled by Oracle and used the javax.* package for everything (e.g., javax.servlet, javax.persistence).

Oracle gave the rights to the Eclipse Foundation, who renamed it to Jakarta EE (The Metro Express). They had to change every package name from javax.* to jakarta.*.

Spring Boot 3 completely ditched the old javax.* packages and rides on the new jakarta.* train.

02Code Comparison: The Migration

If you copy-paste code from an old Spring Boot 2 tutorial into your new Spring Boot 3 project, it will break. Here is how you fix it.

Old Spring Boot 2.x (Will FAIL in Spring Boot 3):

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.servlet.http.HttpServletRequest;
import javax.validation.constraints.NotNull;

@Entity
public class OldUser {
@Id
@NotNull
private String name;
}

New Spring Boot 3.x (Correct Code):

import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.validation.constraints.NotNull;

@Entity
public class NewUser {
@Id
@NotNull
private String name;
}

It is literally a search-and-replace of javax to jakarta.

03Other Massive Changes in Spring Boot 3

Beyond the namespace migration, Spring Boot 3 introduced several other massive changes:

1. Minimum Java 17

Spring Boot 3 will not run on Java 8, 11, or 16. You must use Java 17 or 21.

2. Native Support (GraalVM)

Spring Boot 3 allows you to compile your Java app into a native binary. This means your app starts in 0.01 seconds instead of 2 seconds — crucial for serverless AWS Lambda functions where cold starts matter.

3. Improved Observability

Built-in support for Micrometer Tracing and a more powerful Actuator endpoint system.

04Quick Migration Checklist

Quick Migration Checklist

When migrating from Spring Boot 2 to 3, remember these steps:

  • Replace imports: javax.*jakarta.* everywhere in your codebase
  • Update Java version: Ensure you're using JDK 17 or higher
  • Check Hibernate: Spring Boot 3 uses Hibernate 6.x (breaking changes from Hibernate 5)
  • Update test code: Mockito, JUnit, and test annotations may need updates
  • Remove deprecated APIs: Many Spring Boot 2 deprecated methods removed in Boot 3
05Why It Matters / Interview Note

Interview Question: "Why did Spring Boot 3 migrate from javax to jakarta namespace?"

Answer: "Oracle transferred the rights of Java EE to the Eclipse Foundation, which renamed it to Jakarta EE. Because of trademark issues, Eclipse could not legally continue using the javax.* namespace for new versions, so they moved to jakarta.*. Spring Boot 3 adopted Jakarta EE 9+ to stay aligned with modern enterprise Java standards, which required dropping support for Java 8/11 and requiring Java 17+."

Phase 1 Complete! You now understand the tools, the setup, the project structure, and the modern Spring Boot 3.x ecosystem. Ready for Phase 2: Core Spring & Annotations!

Key Takeaways

  • ✅ Spring Boot 3 migrated from javax.* to jakarta.* namespace
  • ✅ Java 17+ is mandatory — Spring Boot 3 doesn't support Java 8/11/16
  • ✅ GraalVM native compilation enables sub-0.01s startup for serverless
  • ✅ Copy-pasting Spring Boot 2 code into Boot 3 will break due to package changes