Spring + MyBatis + Ehcache 整合 CacheManager 版本>2.5,命名空间冲突 解决
2018-02-23 15:27
573 查看
<!--ehcache 加载xml配置信息--> <bean id="ehcacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean"> <!--虽然有默认值,但我发现源码的逻辑是在判定null后设置默认值: __DEFAULT__的, 而在判定null后,如果有过个CacheManager,并不是通过静态方法 CacheManager.create()来获取单例的,而是new CacheManager,有相同的命名空间,就会产生冲突 从Spring框架整合Ehcache就会用该cacheManagerName属性作为命名空间,覆盖ehcache.xml中的name命名空间 从MyBatis加整合Ehcache,配置文件ehcache.xml只能在类路径下,以ehcache.xml中的name作为命名空间,同时MyBatis的ehcache.xml中需要一个defaultCache的配置 所以如此配置,可以在Spring + MyBatis + Ehcache 整合时,实例化两个net.sf.ehcache.CacheManager,各用各的,也避免命名空间的冲突--> <property name="cacheManagerName" value="ehcacheManager"/> <property name="configLocation" value="classpath:ehcache.xml"/> <property name="acceptExisting" value="true"/> </bean>
ehcache.xml 中的 name 命名空间
<ehcache name="ec">
相关文章推荐
- Spring+MyBatis整合开发时 Injection of autowired dependencies failed错误的解决
- 项目SpringMVC+Spring+Mybatis 整合环境搭建(1)-> Spring+Mybatis搭建
- Spring (MVC) 4.3.7 Mybatis3.4.2 (最新版本)整合详细介绍
- springMVC+MyBatis+Spring 整合(4) ---解决Spring MVC 对AOP不起作用的问题
- SpringMVC mybatis or hibernate ehcache二级缓存maven非和maven版本
- 解决多个版本jQuery混用而导致的命名冲突的问题
- <转>myBatis-spring整合之sqlsessionfactory
- 项目SpringMVC+Spring+Mybatis 整合环境搭建(2)-> 测试Spring+Mybatis 环境
- spring boot 整合mybatis如何开启开启驼峰命名转换
- JPA与Spring2.5整合时发生不能创建entityManagerFactory的问题解决方法
- IDEA中解决spring整合mybatis后使用MapperScannerConfigurer扫描mapper包时“ Invalid bound statement (not found)”错误
- Spring+SpringMVC+MyBatis+easyUI整合基础篇(九)版本控制
- MyEclipse 7.0M1 SSH 整合开发问题解决:Spring2.5+hibernate3.1+Struts1.3 +Tomcat6.0
- 使用maven管理依赖,spring版本冲突解决 java.lang.NoSuchMethodError: org.springframework.core.GenericTypeResolver.r
- Spring or SpringBoot项目整合spark日志冲突解决
- MyBatis与Spring 整合后,创建Bean报奇葩错的解决
- springboot整合mybatis mapper注入时显示could not autowire的解决
- 注解的力量 -----Spring 2.5 JPA hibernate 使用方法的点滴整理(四):使用 命名空间 简化配置
- 整合SSM框架—mybatis和mybatis-spring包版本不匹配问题
- 解决<fx:Style>样式设置中报错 必须使用命名空间限定 CSS 选择器“Alert”中的类型“Alert”