Trying to run a unit test on a Controller in my Spring app.
My test class:
@RunWith (SpringJUnit4ClassRunner.class)
@WebAppConfiguration
@ContextConfiguration ({"classpath*:WEB-INF/spring/application-context-config.xml", "data-source-test-config.xml",
"classpath*:WEB-INF/spring/security-context-config.xml"})
public class PropsControllerTest
The error I'm getting:
2015-04-03 23:22:51.729 WARN AbstractApplicationContext:487 - Exception encountered during context initialization - cancelling refresh attempt
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.cache.interceptor.CacheInterceptor#0': Cannot resolve reference to bean 'cacheManager' while setting bean property 'cacheManager'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'cacheManager' is defined
My application-context-config.xml defines:
ehcache.xml Defines:
<ehcache>
<cache name="backslap"
maxBytesLocalHeap="256M"
eternal="false"
timeToLiveSeconds="3600"
overflowToDisk="false"
memoryStoreEvictionPolicy="LRU"/>
</ehcache>
I've got copies of ehcache.xml in three places: src/main/resources/, test/main/resources/ and in the directory of my test class. Nothing fixes this problem.
How do I make Spring find the file during testing (it has no problem finding the file when running)? Failing that, how do I make Spring stop wanting this information (the cache is utterly worthless during my tests), or at least let me just specify it in my application-context-config.xml file?
Thank you for any help.
No comments:
Post a Comment