我已經升級了我的應用程序到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如何正確地解決這個問題..很好幫助 –