spring-framework icon indicating copy to clipboard operation
spring-framework copied to clipboard

Add support for @Cacheable in native-image

Open mhalbritter opened this issue 3 years ago • 0 comments

@Cacheable doesn't work in native-image. There is no exception, the annotated method is called multiple times, while as on the JVM, it's only called once.

You can observe this in https://github.com/spring-projects/spring-aot-smoke-tests/tree/main/cache-caffeine

I guess this is related to the "proxies in native-image" issue.

mhalbritter avatar Aug 09 '22 12:08 mhalbritter

I think there is no exception because there are missing reflection hints for @Cacheable and related annotated method.

There is also a need for a CacheableBeanRegistrationAotProcessor to register related JDK dynamic proxies when they are used. Class proxies will hopefully be supported via #28115 once integrated in Spring Boot.

sdeleuze avatar Aug 11 '22 15:08 sdeleuze