cache.xml

37 lines | 1.508 kB Blame History Raw Download
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:cache="http://www.springframework.org/schema/cache"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
	xmlns:p="http://www.springframework.org/schema/p"
	xsi:schemaLocation="
			http://www.springframework.org/schema/beans 
			http://www.springframework.org/schema/beans/spring-beans.xsd 
			http://www.springframework.org/schema/cache
			http://www.springframework.org/schema/cache/spring-cache.xsd">

	<cache:annotation-driven />
				
	<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager"
		p:cache-manager-ref="ehcache" />

	<bean id="ehcache"
		class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean"
		p:cacheManagerName="myCacheManager" p:shared="true" p:config-location="classpath:ehcache.xml" />

    <!--Jhonny: added to monitor statistics-->
    <bean id="managementService" class="net.sf.ehcache.management.ManagementService"
          init-method="init"
          destroy-method="dispose">
        <constructor-arg ref="ehcache"/>
        <constructor-arg ref="mbeanServer"/>
        <constructor-arg index="2" value="false"/>
        <constructor-arg index="3" value="false"/>
        <constructor-arg index="4" value="false"/>
        <constructor-arg index="5" value="true"/>
    </bean>
    <bean id="mbeanServer" class="org.springframework.jmx.support.MBeanServerFactoryBean">
        <property name="locateExistingServerIfPossible" value="true"/>
    </bean>

		
</beans>