使用spring3.05,加ehcache-spring-annotations,想实现缓存。but...
@Cacheable(cacheName="departCache")注解总是不生效...
贴上配置文件:
applicationContext.xml
   <ehcache:annotation-driven cache-manager="ehCacheManager"/>    <bean id="ehCacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">  
         <property name="configLocation" value="classpath:spring/ehcache.xml" />  
   </bean>
ehcache.xml
   <?xml version="1.0" encoding="UTF-8"?>
   <ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="http://ehcache.org/ehcache.xsd"
    updateCheck="false" >
      <diskStore path="d:/eh" />  
      <defaultCache eternal="false" 
       maxElementsInMemory="1000"
       overflowToDisk="false" 
       diskPersistent="false" 
       timeToIdleSeconds="0"
       timeToLiveSeconds="600" 
       memoryStoreEvictionPolicy="LRU" />      <cache name="departCache" 
       eternal="true"
       maxElementsInMemory="1000"
       overflowToDisk="true"
       diskPersistent="false"
       memoryStoreEvictionPolicy="LRU" />
   
    </ehcache>service中使用注解让返回的内容缓存:
         @Cacheable(cacheName="departCache")
public List<City> getData(City city){
return cityDao.getCity(city);
}可是每次请求都执行了getData(City city)方法,没有缓存。。
大虾们帮我看看啊,我就找了几天了,就是不知道哪里出现了问题,对了,系统启动后会有缓存的文件departCache.data,但里面总是空的