Implementing fallback with cached data

The fallback implementation presented in the previous example is very simple. Returning an empty list does not make much sense for an application running in production. It makes more sense to use the fallback method in your application when you read data from a cache in case of a request failure, for example. Such a cache may be implemented inside the client application or with the use of third-party tools, such as Redis, Hazelcast, or EhCache. The simplest implementation is available within the Spring Framework, and can be used after including the spring-boot-starter-cache artifact with your dependencies. To enable caching for the Spring Boot application, you should annotate the main or configuration ...

Get Mastering Spring Cloud now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.