@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.
Comment From: sdeleuze
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.