Skip to content

Instantly share code, notes, and snippets.

@sshaaf
Created January 21, 2026 15:24
Show Gist options
  • Select an option

  • Save sshaaf/1dc5641d7fd8e37a7c0183123146dc22 to your computer and use it in GitHub Desktop.

Select an option

Save sshaaf/1dc5641d7fd8e37a7c0183123146dc22 to your computer and use it in GitHub Desktop.
---
# Spring Framework 5.x to 6.0 Migration Rules
# Generated from: https://github.com/spring-projects/spring-framework/wiki/Spring-Framework-6.0-Release-Notes
# =============================================================================
# Jakarta EE Migration (javax → jakarta)
# =============================================================================
- ruleID: "spring6-javax-servlet-to-jakarta-00001"
message: |
Due to the Jakarta EE migration in Spring Framework 6.0, `javax.servlet` imports must be changed to `jakarta.servlet`.
**Before:**
```java
import javax.servlet.http.HttpServletRequest;
```
**After:**
```java
import jakarta.servlet.http.HttpServletRequest;
```
Make sure to upgrade to Tomcat 10+, Jetty 11+, or Undertow 2.2.19+ with the `undertow-servlet-jakarta` artifact.
description: "Detects javax.servlet imports that need migration to jakarta.servlet"
category: "mandatory"
effort: 1
labels:
- "konveyor.io/source=spring5"
- "konveyor.io/target=spring6+"
links:
- title: "Spring Framework 6.0 Release Notes"
url: "https://github.com/spring-projects/spring-framework/wiki/Spring-Framework-6.0-Release-Notes#web-applications"
when:
java.referenced:
pattern: "javax.servlet"
location: "IMPORT"
- ruleID: "spring6-javax-persistence-to-jakarta-00002"
message: |
Due to the Jakarta EE migration in Spring Framework 6.0, `javax.persistence` imports must be changed to `jakarta.persistence`.
**Before:**
```java
import javax.persistence.Entity;
import javax.persistence.Id;
```
**After:**
```java
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
```
Upgrade to Hibernate ORM 5.6.x with `hibernate-core-jakarta` artifact, or migrate to Hibernate ORM 6.1+.
description: "Detects javax.persistence imports that need migration to jakarta.persistence"
category: "mandatory"
effort: 1
labels:
- "konveyor.io/source=spring5"
- "konveyor.io/target=spring6+"
links:
- title: "Spring Framework 6.0 Release Notes"
url: "https://github.com/spring-projects/spring-framework/wiki/Spring-Framework-6.0-Release-Notes#data-access-and-transactions"
when:
java.referenced:
pattern: "javax.persistence"
location: "IMPORT"
- ruleID: "spring6-javax-inject-to-jakarta-00003"
message: |
The JSR-330 based `@Inject` annotation is now found in `jakarta.inject` package in Spring Framework 6.0.
**Before:**
```java
import javax.inject.Inject;
```
**After:**
```java
import jakarta.inject.Inject;
```
Note: Spring 6.0 still detects `javax` equivalents for backwards compatibility, but migration is recommended.
description: "Detects javax.inject imports that should migrate to jakarta.inject"
category: "potential"
effort: 1
labels:
- "konveyor.io/source=spring5"
- "konveyor.io/target=spring6+"
links:
- title: "Spring Framework 6.0 Release Notes"
url: "https://github.com/spring-projects/spring-framework/wiki/Spring-Framework-6.0-Release-Notes#core-container"
when:
java.referenced:
pattern: "javax.inject"
location: "IMPORT"
- ruleID: "spring6-javax-validation-to-jakarta-00004"
message: |
Due to the Jakarta EE migration, `javax.validation` imports must be changed to `jakarta.validation`.
**Before:**
```java
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
```
**After:**
```java
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotNull;
```
Upgrade to Hibernate Validator 7.0.x or 8.0.x.
description: "Detects javax.validation imports that need migration to jakarta.validation"
category: "mandatory"
effort: 1
labels:
- "konveyor.io/source=spring5"
- "konveyor.io/target=spring6+"
links:
- title: "Spring Framework 6.0 Release Notes"
url: "https://github.com/spring-projects/spring-framework/wiki/Spring-Framework-6.0-Release-Notes#data-access-and-transactions"
when:
java.referenced:
pattern: "javax.validation"
location: "IMPORT"
- ruleID: "spring6-javax-annotation-postconstruct-00005"
message: |
The JSR-250 based `@PostConstruct` annotation is now found in `jakarta.annotation` package in Spring Framework 6.0.
**Before:**
```java
import javax.annotation.PostConstruct;
```
**After:**
```java
import jakarta.annotation.PostConstruct;
```
Note: Spring 6.0 still detects `javax` equivalents for backwards compatibility, but migration is recommended.
description: "Detects javax.annotation.PostConstruct imports that should migrate to jakarta.annotation"
category: "potential"
effort: 1
labels:
- "konveyor.io/source=spring5"
- "konveyor.io/target=spring6+"
links:
- title: "Spring Framework 6.0 Release Notes"
url: "https://github.com/spring-projects/spring-framework/wiki/Spring-Framework-6.0-Release-Notes#core-container"
when:
java.referenced:
pattern: "javax.annotation.PostConstruct"
location: "IMPORT"
- ruleID: "spring6-javax-annotation-predestroy-00006"
message: |
The JSR-250 based `@PreDestroy` annotation is now found in `jakarta.annotation` package in Spring Framework 6.0.
**Before:**
```java
import javax.annotation.PreDestroy;
```
**After:**
```java
import jakarta.annotation.PreDestroy;
```
Note: Spring 6.0 still detects `javax` equivalents for backwards compatibility, but migration is recommended.
description: "Detects javax.annotation.PreDestroy imports that should migrate to jakarta.annotation"
category: "potential"
effort: 1
labels:
- "konveyor.io/source=spring5"
- "konveyor.io/target=spring6+"
links:
- title: "Spring Framework 6.0 Release Notes"
url: "https://github.com/spring-projects/spring-framework/wiki/Spring-Framework-6.0-Release-Notes#core-container"
when:
java.referenced:
pattern: "javax.annotation.PreDestroy"
location: "IMPORT"
- ruleID: "spring6-javax-websocket-to-jakarta-00007"
message: |
Due to the Jakarta EE migration in Spring Framework 6.0, `javax.websocket` imports must be changed to `jakarta.websocket`.
**Before:**
```java
import javax.websocket.Session;
import javax.websocket.OnMessage;
```
**After:**
```java
import jakarta.websocket.Session;
import jakarta.websocket.OnMessage;
```
Spring Framework 6.0 supports Jakarta WebSocket 2.1.
description: "Detects javax.websocket imports that need migration to jakarta.websocket"
category: "mandatory"
effort: 1
labels:
- "konveyor.io/source=spring5"
- "konveyor.io/target=spring6+"
links:
- title: "Spring Framework 6.0 Release Notes"
url: "https://github.com/spring-projects/spring-framework/wiki/Spring-Framework-6.0-Release-Notes#spring-messaging"
when:
java.referenced:
pattern: "javax.websocket"
location: "IMPORT"
# =============================================================================
# Removed APIs
# =============================================================================
- ruleID: "spring6-commons-multipart-removed-00008"
message: |
Apache Commons FileUpload (`CommonsMultipartResolver`) has been removed in Spring Framework 6.0.
**Before:**
```java
@Bean
public CommonsMultipartResolver multipartResolver() {
return new CommonsMultipartResolver();
}
```
**After:**
```java
@Bean
public StandardServletMultipartResolver multipartResolver() {
return new StandardServletMultipartResolver();
}
```
Use `StandardServletMultipartResolver` instead and configure multipart in your servlet container.
description: "Detects removed CommonsMultipartResolver usage"
category: "mandatory"
effort: 3
labels:
- "konveyor.io/source=spring5"
- "konveyor.io/target=spring6+"
links:
- title: "Spring Framework 6.0 Release Notes"
url: "https://github.com/spring-projects/spring-framework/wiki/Spring-Framework-6.0-Release-Notes#web-applications"
when:
java.referenced:
pattern: "org.springframework.web.multipart.commons.CommonsMultipartResolver"
location: "IMPORT"
- ruleID: "spring6-ehcache-removed-00009"
message: |
The `org.springframework.cache.ehcache` package has been removed in Spring Framework 6.0 as it was providing support for Ehcache 2.x.
Ehcache 2.x uses Java EE APIs and is End Of Life. Migrate to Ehcache 3.x.
**Migration steps:**
1. Update dependency from `net.sf.ehcache:ehcache` to `org.ehcache:ehcache` (with `jakarta` classifier)
2. Use Ehcache through JCache API or its native API
3. Consult the official Ehcache migration guide
description: "Detects removed Spring Ehcache 2.x integration"
category: "mandatory"
effort: 5
labels:
- "konveyor.io/source=spring5"
- "konveyor.io/target=spring6+"
links:
- title: "Spring Framework 6.0 Release Notes"
url: "https://github.com/spring-projects/spring-framework/wiki/Spring-Framework-6.0-Release-Notes#removed-apis"
when:
java.referenced:
pattern: "org.springframework.cache.ehcache"
location: "IMPORT"
- ruleID: "spring6-joda-time-removed-00010"
message: |
Joda-Time support in `org.springframework.format.datetime` has been removed in Spring Framework 6.0.
Migrate to the `java.time` types (JSR-310).
**Before:**
```java
import org.joda.time.DateTime;
import org.joda.time.LocalDate;
```
**After:**
```java
import java.time.ZonedDateTime;
import java.time.LocalDate;
```
description: "Detects Joda-Time usage that needs migration to java.time"
category: "mandatory"
effort: 3
labels:
- "konveyor.io/source=spring5"
- "konveyor.io/target=spring6+"
links:
- title: "Spring Framework 6.0 Release Notes"
url: "https://github.com/spring-projects/spring-framework/wiki/Spring-Framework-6.0-Release-Notes#removed-apis"
when:
java.referenced:
pattern: "org.joda.time"
location: "IMPORT"
- ruleID: "spring6-http-invoker-removed-00011"
message: |
HTTP Invoker remoting has been removed in Spring Framework 6.0.
RPC-style remoting (Hessian, HTTP Invoker, JMS Invoker, JAX-WS) has been officially deprecated for several years and is now removed.
**Migration:**
Replace with REST-based communication using `RestTemplate`, `WebClient`, or HTTP interface clients with `@HttpExchange`.
description: "Detects removed HTTP Invoker remoting usage"
category: "mandatory"
effort: 5
labels:
- "konveyor.io/source=spring5"
- "konveyor.io/target=spring6+"
links:
- title: "Spring Framework 6.0 Release Notes"
url: "https://github.com/spring-projects/spring-framework/wiki/Spring-Framework-6.0-Release-Notes#removed-apis"
- title: "GitHub Issue #27422"
url: "https://github.com/spring-projects/spring-framework/issues/27422"
when:
java.referenced:
pattern: "org.springframework.remoting.httpinvoker"
location: "IMPORT"
- ruleID: "spring6-hessian-removed-00012"
message: |
Hessian remoting support has been removed in Spring Framework 6.0.
RPC-style remoting has been officially deprecated for several years and is now removed.
**Migration:**
Replace with REST-based communication using `RestTemplate`, `WebClient`, or the new HTTP interface clients with `@HttpExchange`.
description: "Detects removed Hessian remoting usage"
category: "mandatory"
effort: 5
labels:
- "konveyor.io/source=spring5"
- "konveyor.io/target=spring6+"
links:
- title: "Spring Framework 6.0 Release Notes"
url: "https://github.com/spring-projects/spring-framework/wiki/Spring-Framework-6.0-Release-Notes#removed-apis"
- title: "GitHub Issue #27422"
url: "https://github.com/spring-projects/spring-framework/issues/27422"
when:
java.referenced:
pattern: "org.springframework.remoting.caucho"
location: "IMPORT"
- ruleID: "spring6-jaxws-removed-00013"
message: |
JAX-WS support has been removed in Spring Framework 6.0.
RPC-style remoting has been officially deprecated for several years and is now removed.
**Migration:**
Replace with REST-based communication using `RestTemplate`, `WebClient`, or the new HTTP interface clients with `@HttpExchange`.
description: "Detects removed JAX-WS support usage"
category: "mandatory"
effort: 5
labels:
- "konveyor.io/source=spring5"
- "konveyor.io/target=spring6+"
links:
- title: "Spring Framework 6.0 Release Notes"
url: "https://github.com/spring-projects/spring-framework/wiki/Spring-Framework-6.0-Release-Notes#removed-apis"
- title: "GitHub Issue #27422"
url: "https://github.com/spring-projects/spring-framework/issues/27422"
when:
java.referenced:
pattern: "org.springframework.remoting.jaxws"
location: "IMPORT"
- ruleID: "spring6-jms-invoker-removed-00014"
message: |
JMS Invoker remoting support has been removed in Spring Framework 6.0.
RPC-style remoting has been officially deprecated for several years and is now removed.
**Migration:**
Replace with message-driven architecture using Spring JMS message listeners or Spring Cloud Stream.
description: "Detects removed JMS Invoker remoting usage"
category: "mandatory"
effort: 5
labels:
- "konveyor.io/source=spring5"
- "konveyor.io/target=spring6+"
links:
- title: "Spring Framework 6.0 Release Notes"
url: "https://github.com/spring-projects/spring-framework/wiki/Spring-Framework-6.0-Release-Notes#removed-apis"
- title: "GitHub Issue #27422"
url: "https://github.com/spring-projects/spring-framework/issues/27422"
when:
java.referenced:
pattern: "org.springframework.jms.remoting"
location: "IMPORT"
- ruleID: "spring6-tiles-removed-00015"
message: |
Apache Tiles integration has been removed in Spring Framework 6.0.
**Migration options:**
1. Use Thymeleaf for server-side templating
2. Use FreeMarker templates (not JSP integration)
3. Consider a REST-oriented architecture with a frontend framework
description: "Detects removed Apache Tiles integration"
category: "mandatory"
effort: 5
labels:
- "konveyor.io/source=spring5"
- "konveyor.io/target=spring6+"
links:
- title: "Spring Framework 6.0 Release Notes"
url: "https://github.com/spring-projects/spring-framework/wiki/Spring-Framework-6.0-Release-Notes#web-applications"
when:
java.referenced:
pattern: "org.springframework.web.servlet.view.tiles"
location: "IMPORT"
- ruleID: "spring6-freemarker-jsp-removed-00016"
message: |
FreeMarker JSP support has been removed in Spring Framework 6.0.
**Migration:**
Use regular FreeMarker template views without JSP integration, or migrate to Thymeleaf for server-side templating.
Consider a REST-oriented architecture with a frontend framework for modern applications.
description: "Detects FreeMarker usage that may need review"
category: "potential"
effort: 3
labels:
- "konveyor.io/source=spring5"
- "konveyor.io/target=spring6+"
links:
- title: "Spring Framework 6.0 Release Notes"
url: "https://github.com/spring-projects/spring-framework/wiki/Spring-Framework-6.0-Release-Notes#web-applications"
when:
java.referenced:
pattern: "org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver"
location: "IMPORT"
# =============================================================================
# Deprecated APIs
# =============================================================================
- ruleID: "spring6-listenable-future-deprecated-00017"
message: |
`ListenableFuture` has been deprecated in Spring Framework 6.0 in favor of `CompletableFuture`.
**Before:**
```java
import org.springframework.util.concurrent.ListenableFuture;
ListenableFuture<String> future = asyncService.doSomething();
future.addCallback(result -> { ... }, ex -> { ... });
```
**After:**
```java
import java.util.concurrent.CompletableFuture;
CompletableFuture<String> future = asyncService.doSomething();
future.thenAccept(result -> { ... }).exceptionally(ex -> { ... });
```
description: "Detects deprecated ListenableFuture usage"
category: "potential"
effort: 2
labels:
- "konveyor.io/source=spring5"
- "konveyor.io/target=spring6+"
links:
- title: "Spring Framework 6.0 Release Notes"
url: "https://github.com/spring-projects/spring-framework/wiki/Spring-Framework-6.0-Release-Notes#core-container"
- title: "GitHub Issue #27780"
url: "https://github.com/spring-projects/spring-framework/issues/27780"
when:
java.referenced:
pattern: "org.springframework.util.concurrent.ListenableFuture"
location: "IMPORT"
- ruleID: "spring6-trailing-slash-deprecated-00018"
message: |
As of Spring Framework 6.0, the trailing slash matching configuration option has been deprecated and its default value set to false.
Previously, controllers would match both "GET /some/greeting" and "GET /some/greeting/". Now "GET /some/greeting/" results in HTTP 404.
**Migration options:**
1. Configure explicit redirects/rewrites through a proxy or Servlet filter
2. Declare additional routes explicitly: `@GetMapping("/path", "/path/")`
3. Re-enable trailing slash matching globally:
```java
@Configuration
public class WebConfiguration implements WebMvcConfigurer {
@Override
public void configurePathMatch(PathMatchConfigurer configurer) {
configurer.setUseTrailingSlashMatch(true);
}
}
```
description: "Detects @GetMapping with trailing slash patterns that may break in Spring 6"
category: "potential"
effort: 2
labels:
- "konveyor.io/source=spring5"
- "konveyor.io/target=spring6+"
links:
- title: "Spring Framework 6.0 Release Notes"
url: "https://github.com/spring-projects/spring-framework/wiki/Spring-Framework-6.0-Release-Notes#web-applications"
when:
java.referenced:
pattern: "org.springframework.web.bind.annotation.GetMapping"
location: "ANNOTATION"
annotated:
elements:
- name: "value"
value: ".*/$"
# =============================================================================
# Dependency Updates
# =============================================================================
- ruleID: "spring6-httpclient4-to-httpclient5-00019"
message: |
`RestTemplate` with `HttpComponentsClientHttpRequestFactory` now requires Apache HttpClient 5 in Spring Framework 6.0.
**Before:**
```java
import org.apache.http.client.HttpClient;
import org.apache.http.impl.client.HttpClients;
```
**After:**
```java
import org.apache.hc.client5.http.classic.HttpClient;
import org.apache.hc.client5.http.impl.classic.HttpClients;
```
Update your dependency from `org.apache.httpcomponents:httpclient` to `org.apache.httpcomponents.client5:httpclient5`.
description: "Detects Apache HttpClient 4.x usage that needs upgrade to HttpClient 5"
category: "mandatory"
effort: 3
labels:
- "konveyor.io/source=spring5"
- "konveyor.io/target=spring6+"
links:
- title: "Spring Framework 6.0 Release Notes"
url: "https://github.com/spring-projects/spring-framework/wiki/Spring-Framework-6.0-Release-Notes#web-applications"
when:
java.referenced:
pattern: "org.apache.http.client.HttpClient"
location: "IMPORT"
- ruleID: "spring6-ehcache2-dependency-00020"
message: |
Ehcache 2.x dependency detected. Spring Framework 6.0 has removed support for Ehcache 2.x.
**Before (pom.xml):**
```xml
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache</artifactId>
</dependency>
```
**After:**
```xml
<dependency>
<groupId>org.ehcache</groupId>
<artifactId>ehcache</artifactId>
<classifier>jakarta</classifier>
</dependency>
```
Migrate to Ehcache 3.x using JCache API or its native API.
description: "Detects Ehcache 2.x Maven dependency"
category: "mandatory"
effort: 3
labels:
- "konveyor.io/source=spring5"
- "konveyor.io/target=spring6+"
links:
- title: "Spring Framework 6.0 Release Notes"
url: "https://github.com/spring-projects/spring-framework/wiki/Spring-Framework-6.0-Release-Notes#removed-apis"
when:
builtin.xml:
xpath: "//dependency[artifactId[text()='ehcache'] and groupId[text()='net.sf.ehcache']]"
- ruleID: "spring6-httpclient4-dependency-00021"
message: |
Apache HttpClient 4.x dependency detected. Spring Framework 6.0 requires HttpClient 5 for `RestTemplate`.
**Before (pom.xml):**
```xml
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
```
**After:**
```xml
<dependency>
<groupId>org.apache.httpcomponents.client5</groupId>
<artifactId>httpclient5</artifactId>
</dependency>
```
description: "Detects Apache HttpClient 4.x Maven dependency"
category: "mandatory"
effort: 2
labels:
- "konveyor.io/source=spring5"
- "konveyor.io/target=spring6+"
links:
- title: "Spring Framework 6.0 Release Notes"
url: "https://github.com/spring-projects/spring-framework/wiki/Spring-Framework-6.0-Release-Notes#web-applications"
when:
builtin.xml:
xpath: "//dependency[artifactId[text()='httpclient'] and groupId[text()='org.apache.httpcomponents']]"
- ruleID: "spring6-joda-time-dependency-00022"
message: |
Joda-Time dependency detected. Spring Framework 6.0 has removed Joda-Time support.
**Migration:**
Remove the Joda-Time dependency and migrate to `java.time` types (JSR-310).
**Before:**
```java
org.joda.time.DateTime
org.joda.time.LocalDate
```
**After:**
```java
java.time.ZonedDateTime
java.time.LocalDate
```
description: "Detects Joda-Time Maven dependency"
category: "mandatory"
effort: 3
labels:
- "konveyor.io/source=spring5"
- "konveyor.io/target=spring6+"
links:
- title: "Spring Framework 6.0 Release Notes"
url: "https://github.com/spring-projects/spring-framework/wiki/Spring-Framework-6.0-Release-Notes#removed-apis"
when:
builtin.xml:
xpath: "//dependency[artifactId[text()='joda-time']]"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment