How to access value cached using spring @cacheable in other controllers?

Viewed 3628

I have a frequently accessed but bulky value - valueA which is obtained by a method - methodA of rest controller - ControllerA. So I have cached this value using @Cacheable annotation as follows.

    @CacheConfig(cacheNames={"abc_cache"})
    public class ControllerA
{

    @Cacheable
    @RequestMapping(value = "/value/" , method=RequestMethod.GET)
    public ResponseEntity<Value> fetchValue()
    {
       // some logic
       return new ResponseEntity<Value>(value, HttpStatus.OK);
    }
}

I want to access this value in another method - methodB of another controller - controllerB. How can I access this value?

2 Answers
Related