Having the following code running on Quarkus:
@Singleton
@RegisterForReflection
public class StoreService {
private static final Logger LOGGER = Logger.getLogger(StoreService.class);
@Inject
@RestClient
StoresApiClient client;
@CacheResult(cacheName = "stores")
@Fallback(fallbackMethod = "allFallbackStores")
public List<Store> allStores() {
// call REST API using client
}
@SuppressWarnings("unused")
public List<Store> allFallbackStores() {
try {
LOGGER.info("Falling back to internal stores list");
...
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
the fallback mechanism is working properly in regular JDK mode. On the other hand in native image mode, @Fallback
annotation is not being respected and an exception is thrown after unsuccessful API call. What might be a reason for that if @RegisterForReflection
annotation is in place?