| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- <?xml version="1.0" encoding="UTF-8"?>
- <beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
- xmlns:p="http://www.springframework.org/schema/p" xmlns:tx="http://www.springframework.org/schema/tx"
- xmlns:context="http://www.springframework.org/schema/context"
- xmlns:websocket="http://www.springframework.org/schema/websocket"
- xmlns:cache="http://www.springframework.org/schema/cache"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
- http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
- http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
- http://www.springframework.org/schema/websocket http://www.springframework.org/schema/websocket/spring-websocket.xsd
- http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd">
-
- <!-- spring cache 配置 -->
- <!-- 启用缓存注解功能,这个是必须的,否则注解不会生效,另外,该注解一定要声明在spring主配置文件中才会生效 -->
- <cache:annotation-driven cache-manager="cacheManager"/>
-
- <!-- ===========================spring cache 基于 ehcache 的实现============================= -->
- <!-- cacheManager工厂类,指定ehcache.xml的位置 -->
- <!-- EhCache library setup -->
- <bean id="ehcache" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean"
- p:configLocation="classpath:ehcache.xml"/>
-
- <bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager"
- p:cacheManager-ref="ehcache" />
-
-
- <!-- 配置一个简单的缓存工厂bean对象 -->
- <!-- <bean id="simpleCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean"> -->
- <!-- <property name="cacheManager" ref="cacheManager" /> -->
- <!-- 使用缓存 关联ehcache.xml中的缓存配置 -->
- <!-- <property name="cacheName" value="userCache" /> -->
- <!-- </bean> -->
- <!-- 配置一个缓存拦截器对象,处理具体的缓存业务 -->
- <!-- <bean id="methodCacheInterceptor" class="com.loygra.cdf.interceptor.MethodCacheInterceptor"> -->
- <!-- <property name="cache" ref="simpleCache" /> -->
- <!-- </bean> -->
- <!-- 参与缓存的切入点对象 (切入点对象,确定何时何地调用拦截器) -->
- <!-- <bean id="methodCachePointCut" -->
- <!-- class="org.springframework.aop.support.RegexpMethodPointcutAdvisor"> -->
- <!-- 配置缓存aop切面 -->
- <!-- <property name="advice" ref="methodCacheInterceptor" /> -->
- <!-- 配置哪些方法参与缓存策略 .表示符合任何单一字元 ### +表示符合前一个字元一次或多次 ### *表示符合前一个字元零次或多次 ###
- \Escape任何Regular expression使用到的符号 .*表示前面的前缀(包括包名) 表示print方法 -->
- <!-- <property name="patterns"> -->
- <!-- <list> -->
- <!-- <value>.*GetUserById</value> -->
- <!-- </list> -->
- <!-- </property> -->
- <!-- </bean> -->
- <!-- <bean -->
- <!-- class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator"> -->
- <!-- <property name="beanNames" value="*Impl" /> -->
- <!-- <property name="interceptorNames"> -->
- <!-- <list> -->
- <!-- <value>methodCachePointCut</value> -->
- <!-- </list> -->
- <!-- </property> -->
- <!-- <property name="optimize" value="true" /> -->
- <!-- </bean> -->
- </beans>
|