Hutool的BeanUtil.copyProperties的ignoreNullValue不生效
# 1、问题描述
在学习 redis 做黑马点评项目的时候,有个是根据 ID 获取商铺信息的,我使用的是 hash 结构,需要将实体类转化为 map 结构,我使用的是 hutool 工具类提供的 BeanUtil,以下是我的代码:
@Override public Result queryById(Long id) { String shopKey = CACHE_SHOP_KEY + id; // 1、从 redis 缓存中获取商铺信息 Map<Object, Object> shopMap =...
more...
Redis取数据报错:org.springframework.data.redis.RedisSystemException_ Error in execution; nested exception is io.lettuce.core.RedisCom
# 1、问题描述
我的代码是这样的:
/** * 缓存穿透,存储 Hash * * @param keyPrefix 前缀 * @param id 唯一 ID * @param classType 存储类型 * @param dbFallback 回调函数,查询数据库 * @param cacheTtl 过期时间 * @param unit 过期时间单位 * @param <R> 返回值值类型 * @param <K> ID 类型 * @return R */ public <R, K> R...
more...
MySQL建表报错Invalid default value for ‘begin_time‘
我在建表的时候:
DROP TABLE IF EXISTS `tb_blog`;CREATE TABLE `tb_blog` ( `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键', `shop_id` bigint(20) NOT NULL COMMENT '商户id', `user_id` bigint(20) UNSIGNED NOT NULL COMMENT '用户id', `title` varchar(255) CHARACTER SET utf8mb4...
more...
使用Hash结构缓存对象,如何解决缓存穿透问题?
# 1、问题描述
了解了缓存穿透问题后,我就想着使用 hash 结构存储对象。如果用户请求的 ID 不存在的时候,需要在 redis 缓存中缓存 NULL 值,这样显然是不可行的,因为使用通过 entities 返回的类型任然是 Map 类型,不是 null。
StringRedisTemplate 会创建一个空 Map,使用无法通过类似 string 结构的 != null 来判断数据是否在缓存中。
# 2、解决方案
我们可以在根据 ID 获取到的实体信息时不使用 putAll () 方法,我们直接使用 put(key,hashKey,value)方法,我们缓存的 hashKey 和...
more...
使用StringRedisTemplate报错:java.lang.ClassCastException_ java.lang.Long cannot be cast to java.lang.String
# 1、问题描述
我在使用 StringRedisTemplate 来存储对象信息的时候,我使用的是 hash 结构,在运行的同时报错:
java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.String
at org.springframework.data.redis.serializer.StringRedisSerializer.serialize(StringRedisSerializer.java:36) ~[spring-data-redis-2.7.12.jar:2.7.12]
at...
more...
日志报错_WARNING_ An illegal reflective access operation has occurred
# 1、问题描述
在起项目的时候遇到代码段的问题,但是不影响我们的程序启动,和调试,但是居然有错误那就应该好好找找看看是问题了。日志信息:
WARNING: An illegal reflective access operation has occurredWARNING: Illegal reflective access by com.baomidou.mybatisplus.core.toolkit.SetAccessibleAction...
more...
Win10任务栏美化
需要的软件:TranslucentTB
懒人版:
// See https://TranslucentTB.github.io/config for more information{ "$schema": "https://sylveon.dev/TranslucentTB/schema", "desktop_appearance": { "accent": "clear", "color":...
more...








