004-spring cache-声明性的基于XML的缓存
一、概述
如果注释不是选项(不能访问源代码或没有外部代码),可以使用XML进行声明式缓存。因此,不是注释用于缓存的方法,而是从外部指定目标方法和缓存指令(类似于声明式事务管理建议)。
<!-- the service we want to make cacheable -->
<bean id="bookService" class="x.y.service.DefaultBookService"/> <!-- cache definitions -->
<cache:advice id="cacheAdvice" cache-manager="cacheManager">
<cache:caching cache="books">
<cache:cacheable method="findBook" key="#isbn"/>
<cache:cache-evict method="loadBooks" all-entries="true"/>
</cache:caching>
</cache:advice> <!-- apply the cacheable behavior to all BookService interfaces -->
<aop:config>
<aop:advisor advice-ref="cacheAdvice" pointcut="execution(* x.y.BookService.*(..))"/>
</aop:config> <!-- cache manager definition omitted -->
声明式XML缓存支持所有基于注释的模型,因此两者之间的移动应该相当容易 - 两者都可以在同一个应用程序中使用。基于XML的方法不会触及目标代码,但它本质上更加冗长;当处理重载缓存的方法的类时。
具体使用方式,与注解方式一致。
004-spring cache-声明性的基于XML的缓存的更多相关文章
- Unit03: Spring Web MVC简介 、 基于XML配置的MVC应用 、 基于注解配置的MVC应用
Unit03: Spring Web MVC简介 . 基于XML配置的MVC应用 . 基于注解配置的MVC应用 springmvc (1)springmvc是什么? 是一个mvc框架,用来简化基于mv ...
- Spring Cache扩展:注解失效时间+主动刷新缓存(二)
*:first-child { margin-top: 0 !important; } body > *:last-child { margin-bottom: 0 !important; } ...
- Spring Aop(七)——基于XML配置的Spring Aop
转发:https://www.iteye.com/blog/elim-2396043 7 基于XML配置的Spring AOP 基于XML配置的Spring AOP需要引入AOP配置的Schema,然 ...
- 吴裕雄--天生自然JAVA SPRING框架开发学习笔记:Spring使用AspectJ开发AOP基于XML和基于Annotation
AspectJ 是一个基于 Java 语言的 AOP 框架,它扩展了 Java 语言.Spring 2.0 以后,新增了对 AspectJ 方式的支持,新版本的 Spring 框架,建议使用 Aspe ...
- 7 -- Spring的基本用法 -- 11... 基于XML Schema的简化配置方式
7.11 基于XML Schema的简化配置方式 Spring允许使用基于XML Schema的配置方式来简化Spring配置文件. 7.11.1 使用p:命名空间简化配置 p:命名空间不需要特定的S ...
- Spring Cache扩展:注解失效时间+主动刷新缓存
*:first-child { margin-top: 0 !important; } body>*:last-child { margin-bottom: 0 !important; } /* ...
- Spring IOC容器装配Bean_基于XML配置方式
开发所需jar包 实例化Bean的四种方式 1.无参数构造器 (最常用) <?xml version="1.0" encoding="UTF-8"?> ...
- 使用Spring框架入门一:基于XML配置的IOC/DI的使用
一.Spring框架 1.方法一:逐项导入基础依赖包: spring-core.spring-beans.spring-context.spring-expression 2.方法二:最简洁的导入,直 ...
- Spring学习笔记之二----基于XML的Spring AOP配置
在Spring配置文件中,通常使用<aop:config>元素来设置AOP,其中应包括: <aop:aspect>指定aspect,aspect是一个POJO类,包含了很多的a ...
随机推荐
- CSS定位背景图片 background-position
网站的样式的时候经常会发现一种情况,就是在很多background属性里都调用同一张图片,来满足网页各个部分的使用.打开这种图片看一下,会发现这张图片上包含了很多小图片; 又如: 这些小图片就是整图分 ...
- with revoked permission android.permission.CAMERA
1,刚出现这样的问题我是直接把 CAMERA 移除掉 2.第一步判断时候授权. if (Build.VERSION.SDK_INT >= 23) { int checkCallPhonePerm ...
- 基于Cocos2d-x学习OpenGL ES 2.0系列——纹理贴图(6)
在上一篇文章中,我们介绍了如何绘制一个立方体,里面涉及的知识点有VBO(Vertex Buffer Object).IBO(Index Buffer Object)和MVP(Modile-View-P ...
- VC项目程序运行时设置指定目录读取Dll
方法一: 选择当前工程,右击"Properties" -> "Configuration Properties" -> "Debuggin ...
- 【转】Go Channels
转自: http://kdf5000.com/2017/07/16/Go-Channels/ Golang使用Groutine和channels实现了CSP(Communicating Sequent ...
- saltstack安装
环境: 172.16.202.104 stack-master 172.16.202.108 stack-node01 172.16.202.105 stack-node02 安装 导入yum源认证的 ...
- LeetCode——Best Time to Buy and Sell Stock II
Description: Say you have an array for which the ith element is the price of a given stock on day i. ...
- (转)从程序员到CTO
好好努力吧,向优秀的人看齐.文章来自http://blog.csdn.net/smarttony/article/details/6697617
- type 、instanceof、in 和 hasOwnproperty
typeof可以检测的类型有:string.number.boolean.undefined.不可以用typeof检测null typeof也可以用来检测function,但是在IE8及跟早的浏览器中 ...
- 设计模式之一:单例模式(Singleton Pattern)
写这个系列的文章,只为把所学的设计模式再系统的整理一遍.错误和不周到的地方欢迎大家批评.点击这里下载源代码. 什么时候使用单例模式 在程序运行时,某种类型只需要一个实例时,一般采用单例模式.为什么需要 ...