Do not use Ehcache 2.x

Spring Framework 6.0 does not support Ehcache 2.x. The rule flags the usage of org.springframework.cache.ehcache package or presence of ehcache.xml file.

Ehcache 3 is the direct replacement. Update your dependencies to use org.ehcache:ehcache with the jakarta classifier. There is no updated version of org.springframework.cache.ehcache, using Ehcache through the JCache API or its new native API is recommended.

The following example shows a ehcache.xml file that is flagged by this rule.

	<ehcache>
		<diskStore path="java.io.tmpdir"/>
		<defaultCache
			maxElementsInMemory="1000"
			eternal="false"
			timeToIdleSeconds="120"
			timeToLiveSeconds="120"
			overflowToDisk="true"/>
	</ehcache>

The following example shows the updated maven dependency in pom.xml

	<dependency>
		<groupId>org.ehcache</groupId>
		<artifactId>ehcache</artifactId>
		<version>3.10.8</version> 
		<classifier>jakarta</classifier>
	</dependency>

For more information, see the following resources: