今天忽然遇到了一个问题,在junit测试的时候,我的ehcache.xml配置是没有问题的,当我在web中使用的时候就出现找不到的原因,查询了些资料,比较少,都没有知道找到合适的,看到一则关于配置spring页面映射的时候才看到下列代码
public void init(ServletConfig servletConfig) throws ServletException {
ApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(servletConfig.getServletContext());
AllContext.init(ctx);
}
这样就把上面的配置到web.xml中,就可以了,也恍然大悟,那怪我的defaultCacheManager找不到chcache.xml了,原来于此有关,特此记下,以免下次遇到相关的问题可以得到解决。
配置Spring EhCacheManagerFactoryBean关于ehcache.xml的问题
最新推荐文章于 2022-11-21 12:16:14 发布