8.5.2 使用@Cacheable执行缓存
@Cacheable可用于修饰类或修饰方法,当使用@Cacheable修饰类时,用于告诉Spring在类级别上进行缓存 ------ 程序调用该类的实例的任何方法时都需要缓存,而且共享同一个缓存区;当使用@Cacheable修饰方法时,用于告诉Spring在方法级别上进行缓存 ------ 只有当程序调用该方法时才需要缓存。
1. 类级别的缓存
当使用@Cacheable修饰类时,就可控制Spring在类级别进行缓存,这样程序调用类的任意方法时,只要传入的参数相同,Spring就会使用缓存。
Component : UserServiceImpl
啦啦啦
8 -- 深入使用Spring -- 5...2 使用@Cacheable执行缓存
原文:http://www.cnblogs.com/ClassNotFoundException/p/6498588.html