Method visibility and@Cacheable/@CachePut/@CacheEvict

When using proxies, you should apply the @Cache*annotations only to methods with public visibility.

If you do annotate protected, private or package-visible methods with these annotations, no error is raised, but the annotated method does not exhibit the configured caching settings. Consider the use of AspectJ (see below) if you need to annotate non-public methods as it changes the bytecode itself.

 

Ref : https://docs.spring.io/spring/docs/3.2.0.RC1/reference/html/cache.html

 

    咪卡恰比 發表在 痞客邦 留言(0) 人氣()