我正在尝试使用 Spring Modules 项目中的声明性缓存。
它不起作用,即。似乎没有任何东西被缓存。
这是我的配置:
<bean id="cacheManager"
class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
</bean>
<bean id="cacheProviderFacade"
class="org.springmodules.cache.provider.ehcache.EhCacheFacade">
<property name="cacheManager" ref="cacheManager" />
</bean>
<bean id="cacheableService"
class="org.springmodules.cache.interceptor.proxy.CacheProxyFactoryBean">
<property name="cacheProviderFacade" ref="cacheProviderFacade" />
<property name="cachingModels">
<props>
<prop key="get*">cacheName=default</prop>
</props>
</property>
<property name="flushingModels">
<props>
<prop key="update*">cacheNames=default</prop>
</props>
</property>
<property name="target" ref="myServiceBean" />
</bean>
然后,这是 Spring 加载应用程序上下文时的日志记录......
24 Feb 2009 14:26:20,785 INFO org.springframework.cache.ehcache.EhCacheManagerFactoryBean - Initializing EHCache CacheManager
24 Feb 2009 14:26:20,801 DEBUG net.sf.ehcache.CacheManager - Configuring ehcache from classpath.
24 Feb 2009 14:26:20,801 WARN net.sf.ehcache.config.ConfigurationFactory - No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: zip:C:/bea/weblogic81/server/bin/myserver/.wlnotdelete/extract/myserver_threeoneoneonline_threeoneoneonline/jarfiles/WEB-INF/lib/ehcache-1.3.0.jar!/ehcache-failsafe.xml
24 Feb 2009 14:26:20,801 DEBUG net.sf.ehcache.config.ConfigurationFactory - Configuring ehcache from URL: zip:C:/bea/weblogic81/server/bin/myserver/.wlnotdelete/extract/myserver_threeoneoneonline_threeoneoneonline/jarfiles/WEB-INF/lib/ehcache-1.3.0.jar!/ehcache-failsafe.xml
24 Feb 2009 14:26:20,801 DEBUG net.sf.ehcache.config.ConfigurationFactory - Configuring ehcache from InputStream
24 Feb 2009 14:26:20,816 DEBUG net.sf.ehcache.config.DiskStoreConfiguration - Disk Store Path: C:\DOCUME~1\bpapa\LOCALS~1\Temp\
24 Feb 2009 14:26:20,832 DEBUG net.sf.ehcache.config.ConfigurationHelper - No CacheManagerEventListenerFactory class specified. Skipping...
24 Feb 2009 14:26:20,832 DEBUG net.sf.ehcache.config.ConfigurationHelper - No CachePeerListenerFactoryConfiguration specified. Not configuring a CacheManagerPeerListener.
24 Feb 2009 14:26:20,847 DEBUG net.sf.ehcache.config.ConfigurationHelper - No CachePeerProviderFactoryConfiguration specified. Not configuring a CacheManagerPeerProvider.
24 Feb 2009 14:26:20,863 DEBUG net.sf.ehcache.config.ConfigurationHelper - No BootstrapCacheLoaderFactory class specified. Skipping...
在此之后,我点击了一个页面,该页面从“myServiceBean”bean 中调用了一个以“get”为前缀的方法。但是,没有记录任何缓存正在进行。我已经将日志记录一路调高到调试 springmodules、spring 的缓存包和 DEBUG ......因为 Spring Modules 示例在网络上很少而且相距甚远,我想知道是否有人以前看过这个......