I have several read-only resources in my Controller. I want to in-memory cache them, I'm not clear how to do it in Spring Boot. What I've done:
- annotated main Application with
@EnableCaching
- annotated a resource with
@Cacheable
@Cacheable
@RequestMapping(value = "/api/graph", method=RequestMethod.GET, produces = { "application/json"})
public @ResponseBody Iterable<Map<String, String>> graph() {
return Repository.graph();
}
What am I missing?
Since it's a read-only resource I guess I don't neet @CachePut
am I right?
Obiouvsly I added spring-boot-starter-cache
ad dependency in maven