<?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:p="http://www.springframework.org/schema/p"
	   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.2.xsd    
                        http://www.springframework.org/schema/cache
        				http://www.springframework.org/schema/cache/spring-cache-3.2.xsd">
	<!-- http://blog.csdn.net/clj198606061111/article/details/41121437 -->
	<cache:annotation-driven cache-manager="cacheManager" />
	<!-- idea中需要设置p:shared="true"，eclipse不需要设置，否则出错,原因不明...-->
	<bean id="cacheManagerFactory"
		class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean" p:shared="true">
		<property name="configLocation" value="classpath:ehcache.xml" />
	</bean>
	
	<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager">
		<property name="cacheManager" ref="cacheManagerFactory" />
	</bean>
</beans>