我已经升级了我的应用程序到Spring 3.1,并且所有的jar已经被充分更新。但是当我尝试在我的控制器中的某个方法中使用@Cacheable时,该控制器的所有方法的URL映射都会中断。在检查日志文件时,我发现从未检测到该控制器所有方法的URL映射。我很确定我的缓存配置没问题。 任何人都可以给我一些线索,因为我可能做错了什么。Spring @Cacheable正在破解@RequestMapping
ehcache.xml中
<?xml version="1.0" encoding="UTF-8"?>
<ehcache>
<defaultCache
eternal="false"
maxElementsInMemory="2"
overflowToDisk="false"
diskPersistent="false"
timeToLiveSeconds="300"
memoryStoreEvictionPolicy="LRU" />
<cache name="Backlog"
eternal="false"
maxElementsInMemory="2"
overflowToDisk="false"
diskPersistent="false"
timeToLiveSeconds="300"
memoryStoreEvictionPolicy="LRU" />
</ehcache>
配置:
<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager">
<property name="cacheManager">
<ref bean="ehcache" />
</property>
</bean>
<bean id="ehcache" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean" p:configLocation="/WEB-INF/spring-configuration/ehcache.xml" />
代码片段:
@RequestMapping("/*/backlog")
@Cacheable(value = "Backlog")
public ModelAndView getBackLog(){
//sth here
}
感谢您的帮助。
非常感谢,它解决了这个问题。 – pareshverma91
@ pareshverma91如何正确地解决这个问题..很好帮助 –