首页 > 编程语言 > 详细

Springboot工程Mybatis二级缓存配置

时间:2020-07-18 18:21:41      阅读:141      评论:0      收藏:0      [点我收藏+]

1、在application.yml配置cache-enabled: true

    mybatis:
      config-location: classpath:/mybatis-config.xml, classpath:mybatis/mybatis-config.xml
      mapper-locations: classpath:mappers/*.xml,classpath:mybatis/mapper/*.xml
      configuration:
        cache-enabled: true

2、在xxxMapper.xml添加 

     a)<cache></cache>
        
        b) <select id="selectBygoodsCataCodeAndprovinceCode" resultMap="BaseResultMap" useCache="true" >

3)实体对象要implements Serializable,否则报错

public class CompleteTime implements Serializable

4、启动工程,如果出现

Cache Hit Ratio . #表示缓存开启了.....

 

Springboot工程Mybatis二级缓存配置

原文:https://www.cnblogs.com/ywjfx/p/13336460.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!