generated from konveyor/template-repo
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Juan Manuel Leflet Estrada <[email protected]>
- Loading branch information
Showing
6 changed files
with
149 additions
and
2 deletions.
There are no files selected for viewing
63 changes: 63 additions & 0 deletions
63
default/generated/spring-framework/spring-framework-5.x-to-6.0-removed-apis.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
- ruleID: spring-framework-5.x-to-6.0-removed-apis-00001 | ||
category: mandatory | ||
effort: 5 | ||
labels: | ||
- konveyor.io/source=spring5 | ||
- konveyor.io/target=spring6+ | ||
when: | ||
or: | ||
- java.referenced: | ||
pattern: org.springframework.cache.ehcache* | ||
location: IMPORT | ||
- java.dependency: | ||
name: net.sf.ehcache.ehcache | ||
upperbound: 2.10.9.2 | ||
description: Spring Framework 6.0 has dropped support for EhCache 2.x | ||
message: | | ||
The org.springframework.cache.ehcache package has been removed as it was providing support for | ||
Ehcache 2.x - with this version, `net.sf.ehcache` is using Java EE APIs and is about to be End Of Life'd. | ||
Ehcache 3 is the direct replacement. Please revisit your dependency management to use `org.ehcache:ehcache` | ||
(with the jakarta classifier) instead and look into the official migration guide or reach out to the ehcache | ||
community for assistance. | ||
There is no renewed support or helpers for EhCache 3.0 integration anymore, and the `org.springframework.cache.ehcache` | ||
package has been removed. Instead, you can either use the JCache API (JSR-107) or EhCache 3's native API. | ||
If you want to use the JCache (JSR-107) integration, Spring's caching abstraction allows for it: | ||
1. Enable Caching in Spring as usual: | ||
```java | ||
@Configuration | ||
@EnableCaching | ||
public class CacheConfig { | ||
// CacheManager bean configuration goes here | ||
} | ||
``` | ||
2. Configure a JCache `CacheManager`: | ||
```java | ||
import javax.cache.Caching; | ||
import javax.cache.spi.CachingProvider; | ||
import org.springframework.cache.annotation.EnableCaching; | ||
import org.springframework.cache.jcache.JCacheCacheManager; | ||
@Configuration | ||
@EnableCaching | ||
public class CacheConfig { | ||
@Bean | ||
public JCacheCacheManager cacheManager() { | ||
CachingProvider cachingProvider = Caching.getCachingProvider(); | ||
javax.cache.CacheManager ehCacheManager = cachingProvider.getCacheManager(); | ||
return new JCacheCacheManager(ehCacheManager); | ||
} | ||
} | ||
``` | ||
Additionally, you may need to adapt your Ehcache 2.x XML configuration to be compatible with Ehcache 3.x | ||
if you were previously using XML-based cache configurations. | ||
For specifics on how to migrate from Ehcache 2 to 3, please check the link provided. | ||
links: | ||
- title: 'Spring 6.0 migration guide' | ||
url: https://github.com/spring-projects/spring-framework/wiki/Spring-Framework-6.0-Release-Notes#removed-apis | ||
- title: 'Ehcache 2 to 3 migration guide' | ||
url: https://www.ehcache.org/documentation/3.10/migration-guide.html |
File renamed without changes.
52 changes: 52 additions & 0 deletions
52
default/generated/spring-framework/tests/data/removed-apis/ehcache-app/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>com.example</groupId> | ||
<artifactId>spring-boot-ehcache2-example</artifactId> | ||
<version>1.0.0</version> | ||
<packaging>jar</packaging> | ||
|
||
<parent> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-parent</artifactId> | ||
<version>2.7.18</version> | ||
</parent> | ||
|
||
<dependencies> | ||
<!-- Spring Boot Starter Web for creating a web application --> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-web</artifactId> | ||
</dependency> | ||
|
||
<!-- Spring Boot Starter Cache for enabling caching support --> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-cache</artifactId> | ||
</dependency> | ||
|
||
<!-- EhCache 2.x dependency --> | ||
<dependency> | ||
<groupId>net.sf.ehcache</groupId> | ||
<artifactId>ehcache</artifactId> | ||
<version>2.10.9.2</version> <!-- Latest EhCache 2.x version --> | ||
</dependency> | ||
|
||
<!-- Spring Boot Starter Test for testing purposes --> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-test</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-maven-plugin</artifactId> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
20 changes: 20 additions & 0 deletions
20
...k/tests/data/removed-apis/ehcache-app/src/main/java/org/konveyor/EhCache2Application.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package org.konveyor; | ||
|
||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
import org.springframework.cache.annotation.EnableCaching; | ||
import org.springframework.cache.ehcache.EhCacheCacheManager; | ||
import org.springframework.context.annotation.Bean; | ||
|
||
@SpringBootApplication | ||
@EnableCaching | ||
public class EhCache2Application { | ||
public static void main(String[] args) { | ||
SpringApplication.run(EhCache2Application.class, args); | ||
} | ||
|
||
@Bean | ||
public EhCacheCacheManager cacheManager() { | ||
return new EhCacheCacheManager(); | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
default/generated/spring-framework/tests/spring-framework-5.x-to-6.0-baseline.test.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
default/generated/spring-framework/tests/spring-framework-5.x-to-6.0-removed-apis.test.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
rulesPath: ../spring-framework-5.x-to-6.0-removed-apis.yaml | ||
providers: | ||
- name: java | ||
dataPath: ./data/removed-apis/ehcache-app | ||
tests: | ||
- ruleID: spring-framework-5.x-to-6.0-removed-apis-00001 | ||
testCases: | ||
- name: tc-1 | ||
analysisParams: | ||
mode: "source-only" | ||
hasIncidents: | ||
exactly: 2 |