rest-ehcache.xml 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <beans xmlns="http://www.springframework.org/schema/beans"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
  4. xmlns:p="http://www.springframework.org/schema/p" xmlns:tx="http://www.springframework.org/schema/tx"
  5. xmlns:context="http://www.springframework.org/schema/context"
  6. xmlns:websocket="http://www.springframework.org/schema/websocket"
  7. xmlns:cache="http://www.springframework.org/schema/cache"
  8. xsi:schemaLocation="
  9. http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
  10. http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
  11. 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
  12. http://www.springframework.org/schema/websocket http://www.springframework.org/schema/websocket/spring-websocket.xsd
  13. http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd">
  14. <!-- spring cache 配置 -->
  15. <!-- 启用缓存注解功能,这个是必须的,否则注解不会生效,另外,该注解一定要声明在spring主配置文件中才会生效 -->
  16. <cache:annotation-driven cache-manager="cacheManager"/>
  17. <!-- ===========================spring cache 基于 ehcache 的实现============================= -->
  18. <!-- cacheManager工厂类,指定ehcache.xml的位置 -->
  19. <!-- EhCache library setup -->
  20. <bean id="ehcache" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean"
  21. p:configLocation="classpath:ehcache.xml"/>
  22. <bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager"
  23. p:cacheManager-ref="ehcache" />
  24. <!-- 配置一个简单的缓存工厂bean对象 -->
  25. <!-- <bean id="simpleCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean"> -->
  26. <!-- <property name="cacheManager" ref="cacheManager" /> -->
  27. <!-- 使用缓存 关联ehcache.xml中的缓存配置 -->
  28. <!-- <property name="cacheName" value="userCache" /> -->
  29. <!-- </bean> -->
  30. <!-- 配置一个缓存拦截器对象,处理具体的缓存业务 -->
  31. <!-- <bean id="methodCacheInterceptor" class="com.loygra.cdf.interceptor.MethodCacheInterceptor"> -->
  32. <!-- <property name="cache" ref="simpleCache" /> -->
  33. <!-- </bean> -->
  34. <!-- 参与缓存的切入点对象 (切入点对象,确定何时何地调用拦截器) -->
  35. <!-- <bean id="methodCachePointCut" -->
  36. <!-- class="org.springframework.aop.support.RegexpMethodPointcutAdvisor"> -->
  37. <!-- 配置缓存aop切面 -->
  38. <!-- <property name="advice" ref="methodCacheInterceptor" /> -->
  39. <!-- 配置哪些方法参与缓存策略 .表示符合任何单一字元 ### +表示符合前一个字元一次或多次 ### *表示符合前一个字元零次或多次 ###
  40. \Escape任何Regular expression使用到的符号 .*表示前面的前缀(包括包名) 表示print方法 -->
  41. <!-- <property name="patterns"> -->
  42. <!-- <list> -->
  43. <!-- <value>.*GetUserById</value> -->
  44. <!-- </list> -->
  45. <!-- </property> -->
  46. <!-- </bean> -->
  47. <!-- <bean -->
  48. <!-- class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator"> -->
  49. <!-- <property name="beanNames" value="*Impl" /> -->
  50. <!-- <property name="interceptorNames"> -->
  51. <!-- <list> -->
  52. <!-- <value>methodCachePointCut</value> -->
  53. <!-- </list> -->
  54. <!-- </property> -->
  55. <!-- <property name="optimize" value="true" /> -->
  56. <!-- </bean> -->
  57. </beans>