2013-10-06 106 views
0

我已經註釋彈簧單元測試上的EHCache

@RunWith(SpringJUnit4ClassRunner.class) 
@ContextConfiguration(locations = { "file:WebContent/WEB-INF/dispatcher-servlet.xml" }) 

<!-- Start of EhCache --> 
    <cache:annotation-driven /> 
    <context:component-scan base-package="caching" /> 
    <bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager" p:cacheManager-ref="ehcache"/> 
    <bean id="ehcache" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean" 
    p:configLocation="/WEB-INF/ehcache.xml" 
    p:shared="true"/> 
    <!-- End of EhCache --> 

口口聲聲說ehcache.xml中沒有被發現......但正常的服務器上也可以找到。我可否知道這是什麼問題?

回答

0

如果我理解正確,你的spring配置和ehcache配置都在同一個目錄下。所以看來你可以使用p:configLocation="ehcache.xml"