java中如何在项目启动时将一些配置信息加载到Redis中

一、在项目启动时将一些数据库配置信息加载到Redis中

java 复制代码
 /**
     * 初始化配置参数到缓存中
     */
    @PostConstruct
    private void init() {
        Map<Long, Config> configMap = new HashMap<>();
        List<Config> list = attributionConfigDao.selectList(new LambdaQueryWrapper<Config>());
        if (CheckUtils.isNotEmpty(list)){
            for (Config attributionConfig : list) {
                configMap.put(attributionConfig.getSysOrgId(),attributionConfig);
            }
            redisTemplate.opsForHash().putAll("attributionMap", configMap);
        }

    }

点赞加关注,持续更新中!!!

相关推荐
weixin_399380694 分钟前
TongWeb7.0.4.9M11一键安装脚本(by sy)
java·spring
CallFay云起未来10 分钟前
AI客服能不能减少人工回复?从重复咨询到人机协同的落地分析
java·大数据·人工智能·文心一言
我命由我1234514 分钟前
Android 开发 - 获取当前设备屏幕的旋转角度
android·java·java-ee·android studio·android jetpack·android-studio·android runtime
SLD_Allen17 分钟前
Go语言runtime全景
开发语言·javascript·golang
Elastic 中国社区官方博客18 分钟前
OpenTelemetry Java 扩展:无需分叉 agent 即可自定义追踪
java·大数据·运维·开发语言·数据库·人工智能·elasticsearch
不灭的黄金瞳12328 分钟前
C语言手写顺序表
c语言·开发语言·数据结构
只爱喝胡辣汤28 分钟前
Redis Intset(整数集合)技术文档
redis
京东云开发者29 分钟前
上游给空、下游拿到 -1,我把故障一直追到了 commons-beanutils 的构造函数
java·ai编程
阿无,34 分钟前
Java多线程面试题之AQS
java·开发语言