diff --git a/default/generated/spring-framework/spring-framework-5.x-to-6.0-removed-apis.yaml b/default/generated/spring-framework/spring-framework-5.x-to-6.0-removed-apis.yaml new file mode 100644 index 00000000..f9c3babe --- /dev/null +++ b/default/generated/spring-framework/spring-framework-5.x-to-6.0-removed-apis.yaml @@ -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 diff --git a/default/generated/spring-framework/tests/data/pom.xml b/default/generated/spring-framework/tests/data/baseline/pom.xml similarity index 100% rename from default/generated/spring-framework/tests/data/pom.xml rename to default/generated/spring-framework/tests/data/baseline/pom.xml diff --git a/default/generated/spring-framework/tests/data/removed-apis/ehcache-app/pom.xml b/default/generated/spring-framework/tests/data/removed-apis/ehcache-app/pom.xml new file mode 100644 index 00000000..7efc0ec4 --- /dev/null +++ b/default/generated/spring-framework/tests/data/removed-apis/ehcache-app/pom.xml @@ -0,0 +1,52 @@ + + 4.0.0 + + com.example + spring-boot-ehcache2-example + 1.0.0 + jar + + + org.springframework.boot + spring-boot-starter-parent + 2.7.18 + + + + + + org.springframework.boot + spring-boot-starter-web + + + + + org.springframework.boot + spring-boot-starter-cache + + + + + net.sf.ehcache + ehcache + 2.10.9.2 + + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + diff --git a/default/generated/spring-framework/tests/data/removed-apis/ehcache-app/src/main/java/org/konveyor/EhCache2Application.java b/default/generated/spring-framework/tests/data/removed-apis/ehcache-app/src/main/java/org/konveyor/EhCache2Application.java new file mode 100644 index 00000000..8b873bf6 --- /dev/null +++ b/default/generated/spring-framework/tests/data/removed-apis/ehcache-app/src/main/java/org/konveyor/EhCache2Application.java @@ -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(); + } +} \ No newline at end of file diff --git a/default/generated/spring-framework/tests/spring-framework-5.x-to-6.0-baseline.test.yaml b/default/generated/spring-framework/tests/spring-framework-5.x-to-6.0-baseline.test.yaml index c7163f84..211fe99f 100644 --- a/default/generated/spring-framework/tests/spring-framework-5.x-to-6.0-baseline.test.yaml +++ b/default/generated/spring-framework/tests/spring-framework-5.x-to-6.0-baseline.test.yaml @@ -1,9 +1,9 @@ rulesPath: ../spring-framework-5.x-to-6.0-baseline.yaml providers: - name: java - dataPath: ./data + dataPath: ./data/baseline - name: builtin - dataPath: ./data + dataPath: ./data/baseline tests: - ruleID: spring-framework-5.x-to-6.0-baseline-00001 testCases: diff --git a/default/generated/spring-framework/tests/spring-framework-5.x-to-6.0-removed-apis.test.yaml b/default/generated/spring-framework/tests/spring-framework-5.x-to-6.0-removed-apis.test.yaml new file mode 100644 index 00000000..4ec13f59 --- /dev/null +++ b/default/generated/spring-framework/tests/spring-framework-5.x-to-6.0-removed-apis.test.yaml @@ -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