I am currently trying to implement a caching with Redis for Sprint Boot application:
@Cacheable(value = "products", key = "#id")@GetMapping(value = "/product/{id}")public Mono<Product> getProduct(@PathVariable("id") String sku) { ...}
However, I am encountering this exception:
java.lang.IllegalArgumentException: DefaultSerializer requires a Serializable payload but received an object of type [reactor.core.publisher.MonoMapFuseable]
Based on my research, this has to do with it trying to serialize the Mono return type, rather than Product
itself. So my question is, for reactive methods such as this, what is the recommended way of implementing a caching mechanism with Redis? Comments and feedback would be greatly appreciated.