Mybatis在Mapper上加注解关闭二级缓存
发表于|更新于
|浏览量:
久视伤血,久卧伤气,久坐伤肉,久立伤骨,久行伤筋。——曹廷栋
代码如下
1 | import org.apache.ibatis.annotations.CacheNamespace; |
上使用@CacheNamespace注解,并将implementation设置为org.apache.ibatis.cache.impl.PerpetualCache.class,blocking设置为false即可禁用二级缓存
相关推荐
2022-11-11
filterTree递归树过滤实现
二人同心,其利断金;同心之言,其臭如兰——《周易·系辞上》 引入依赖: 123456<!-- https://search.maven.org/artifact/io.github.vampireachao/stream-query --><dependency> <groupId>io.github.vampireachao</groupId> <artifactId>stream-core</artifactId> <version>${stream-query-version}</version></dependency> 使用: 1234567891011121314151617181920212223242526272829303132333435363738394041424344@Test void testFilterTree() { List<Student> studentTr...
2022-09-11
hutool excel写数据
为人但知足,何处不安生——耶律楚材 依赖见:hutool获取excel中的图片 代码如下: 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051package com.ruben;import cn.hutool.core.collection.CollUtil;import cn.hutool.core.date.DateUtil;import cn.hutool.poi.excel.ExcelUtil;import cn.hutool.poi.excel.ExcelWriter;import java.util.ArrayList;import java.util.LinkedHashMap;import java.util.Map;/** * ExcelDemo * * @author VampireAchao * @since 2022/9/7 */public class ExcelDemo { public stat...
2021-03-05
避免list中remove导致ConcurrentModificationException
凡不是就着泪水吃过面包的人是不懂得人生之味的人——歌德 我们在list循环中调用remove函数删除自身元素可能会导致java.util.ConcurrentModificationException 例如 1234// 构造从0到20的listList<Integer> list = Stream.iterate(0, i -> ++i).limit(20).collect(Collectors.toList());// 删除list.forEach(list::remove); 首先我们可以使用removeIf代替 1list.removeIf(i -> i.equals(i)); 其次我们可以使用迭代器 我们可以看到removeIf的源码正是使用了迭代器 如下 12345Iterator<Integer> iterator = list.iterator();while (iterator.hasNext()) { Integer nowNumber = iterator.next(); iterator....
2023-05-03
为shenyu的PortUtils.findPort添加单元测试
爱好自由是人的天性,但往往过度而陷于放纵。斯宾诺莎 今天为shenyu的shenyu-client-core模块下添加了PortUtils.findPort的test case: https://github.com/apache/shenyu/pull/4604 对应的代码如下: 123456789101112131415161718192021222324252627282930313233343536373839404142/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Ve...
2024-12-03
uniapp-x与springboot跑通websocket示例
万人都要将火熄灭,我一人独将此火高高举起。——海子 uniapp-x的 utils/device.ts 1234567891011121314151617181920212223242526272829/** * 获取设备唯一标识符 * @returns {string} 唯一设备标识符 */export function getUniqueDeviceId(): string { let deviceId: string | null = uni.getStorageSync('deviceId'); // 从本地缓存获取 if (!deviceId) { // 如果不存在,生成新的 UUID deviceId = generateUUID(); uni.setStorageSync('deviceId', deviceId); // 存储到本地 } console.log('设备唯一标识: ', d...
2023-12-11
spring-state-machine使用redis持久化
问号是开启任何一门科学的钥匙。——巴甫洛夫 之前介绍过spring-state-machine持久化 今天使用redis实现 首先是需要一个RedisStateMachineRepository 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103import com.alibaba.nacos.common.utils.JacksonUtils;import jakarta.annotation.Nonnull;import jakarta.annotation.Resource;import org.dromara.streamquery.stream.core.stream.Steam;import org.springfra...

阿超
我的名字叫阿超 年龄25岁 家在北京市 职业是软件开发 每天最晚也会在八点前回家 不抽烟 酒浅尝辄止 晚上十二点上床 保证睡足八个小时 睡前写一篇博客 再做二十分钟俯卧撑暖身 然后再睡觉 基本能熟睡到天亮 像婴儿一样不留下任何疲劳和压力 就这样迎来第二天的早晨 健康检查结果也显示我很正常 我想说明我是一个不论何时都追求内心平稳的人 不拘泥于胜负 不纠结于烦恼 不树立使我夜不能寐的敌人 这就是我在这社会的生活态度
Follow Me公告
This is my Blog