Spring Boot Upgrade from 2.6.x to 2.7.0

I have upgraded Spring Boot version from 2.6.9 to 2.7.0 we were getting below error. java.lang.IllegalArgumentException: cannot find cache Named "cacheName"

pom.xml:

 <dependency> <groupid>net.sf.ehcache</> <artifactId>ehcache</> </dependency> 

ehcache.xml:

 <cache name="cacheName" logging="true" maxelementsinmemory="1000" eternal="false" overflowtodisck="false" timetoidleseconds="300" timetoliveseconds="300" memorystorevictionpolicy="LFU"/> JAVA Method: @Cacheable("cacheName") public List getValues(){ return list; } 

Defined @EnableCaching at below class

@SpringBootApplication @EnableCachong public class Application extends SpringBootInitializer{ } 

1 Answer

I'm not seeing any cache configuration in your code snippets. Is the cache implementation supposed to create the cache automatically?

Your application should declare the cache name like this:

spring.cache.cache-names=cacheName 

Also, see this issue which might explain the change of behavior.

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like