@Cacheable annotation reason not to take effect

Because @Cacheable comment applies dynamic AOP proxy, generated proxy class, determine whether there is the key cache, if the call is marked with @Cachable proxy class annotated method does not exist, or is not executed.

So when the method of calling a method in the class A B (labeled @Cacheable notes), since the method call each other inside the class will not generate the proxy class, the annotation does not take effect, and will not be cached.

Solution:

b Methods Method b was placed in class B, class A and class B is a method call.

Guess you like

Origin www.cnblogs.com/BonnieWss/p/11655032.html