applicationContext-ehcache.xml 1019 B

12345678910111213141516171819202122232425
  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"
  4. xmlns:cache="http://www.springframework.org/schema/cache"
  5. xsi:schemaLocation="
  6. http://www.springframework.org/schema/beans
  7. http://www.springframework.org/schema/beans/spring-beans.xsd
  8. http://www.springframework.org/schema/cache
  9. http://www.springframework.org/schema/cache/spring-cache.xsd">
  10. <!-- 支持缓存注解 -->
  11. <cache:annotation-driven cache-manager="cacheManager" />
  12. <!-- 默认是cacheManager -->
  13. <bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager">
  14. <property name="cacheManager" ref="cacheManagerFactory"/>
  15. </bean>
  16. <!-- cache管理器配置 -->
  17. <bean id="cacheManagerFactory" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
  18. <property name="configLocation" value="classpath:ehcache.xml"/>
  19. <property name="shared" value="true" />
  20. </bean>
  21. </beans>