Hi spring boot team,

my spring boot app (v3.0.2) uses spring-boot-starter-cache with com.github.ben-manes.caffeine with the @Cacheable annotation. On JVM mode everything is fine but in native mode I get the following Exception on a request:

myapp | 2023-02-15T13:28:20.590Z ERROR 1 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed: java.lang.IllegalStateException: com.github.benmanes.caffeine.cache.SSW] with root cause
myapp |
myapp | java.lang.NoSuchMethodError: com.github.benmanes.caffeine.cache.SSW.<init>(com.github.benmanes.caffeine.cache.Caffeine, com.github.benmanes.caffeine.cache.AsyncCacheLoader, boolean)

I'm not familiar with runtimeHints but my following try was unfortunately not successfull:

public class CaffeineRuntimeHints implements RuntimeHintsRegistrar {
    @Override
    public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
        hints.reflection().registerType(TypeReference.of("com.github.benmanes.caffeine.cache.SSW"),
                (builder) -> builder.withMembers(MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS));
    }
}

Can anybody help or give me a hint? :-)

Comment From: wilkinsona

This should be handled by the reachability metadata for Caffeine. If that's not working, please open a reachability metadata issue with a minimal example that reproduces the problem.