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);
        }

    }

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

相关推荐
long3162 小时前
封装(Encapsulation)
java·人工智能·ai·ai编程
SomeB1oody2 小时前
【RustyML入门】7.2. 深入模型持久化
开发语言·后端·机器学习·rust·教程
yaoxin5211232 小时前
502. Java 反射 - 编写 MessageInterceptor 类
java·开发语言
wuyk5552 小时前
Python零基础入门第五章:元组Tuple(不可变容器详解、列表与元组区别)
开发语言·python
风流 少年2 小时前
Spring AI 2.0:阿里云百炼平台(工作流应用)
java·后端·spring
长谷深风1112 小时前
AI Tool 设计:粒度、参数与错误恢复怎么做
java·大数据·人工智能·ai agent·agent工作流·智能体设计·ai产品设计
2601_965798472 小时前
Build a Fast, High-Ranking Restaurant Website with Rolanda Theme
开发语言·ios·swift
caimouse2 小时前
ReactOS 窗口系统分析(25):标题栏显示与系统按钮 — nonclient.c 标题栏专题
c语言·开发语言
诺伦2 小时前
Rust 错误处理实战:从 unwrap 到优雅 Result 的进阶之路
开发语言·后端·rust
caimouse3 小时前
ReactOS 窗口系统分析(14):计时器/属性/加速键/热键 — timer.c + prop.c + accelerator.c + hotkey.c
c语言·开发语言·reactos