Quote:
The reason is simple. Spring actually creates a proxy of your bean when you use declarative cache. So, if you call a method of your cacheable bean from some other bean, you actually call a method of a proxy bean (not your target bean) that will apply caching mechanism and call the actual method if neccessary.
But, if your cacheable bean's method call its own method, there is no intercepting mechanism that can apply cache here - this is just a normal method call. So this whole "declarative cache" idea can be applied only for interface/public methods that are exposed for other beans to use.
I was trying to Cache the return of a private method. I'll spin it off and stick it in a separate object and try again.