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

    }

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

相关推荐
plainGeekDev16 分钟前
ProGuard → R8
android·java·kotlin
带刺的坐椅27 分钟前
把 OpenAPI 接入 Agent Harness:零代码让 Agent 听懂你的 REST API
java·ai·llm·agent·solon·restapi·openapi
༄沐࿆风࿆࿆33 分钟前
JavaScript函数完全指南:从基础语法到闭包原理与应用实战
开发语言·javascript
Geek-Chow1 小时前
微服务认证与授权:01 — 概念
java·前端·数据库
KobeSacre1 小时前
DelayQueue 源码
java·开发语言
Wang's Blog1 小时前
JavaWeb快速入门: Filter与Listener核心详解
java·filter·listener
han_hanker1 小时前
重新认识枚举enum
开发语言
zfoo-framework1 小时前
mongodb性能调优 1.从慢查询分析索引 2.掌握索引最左匹配原则!!!
java
烤代码的吐司君1 小时前
Redis IO 多路复用原理与引入原因深度解析
数据库·redis·php
AIGS0011 小时前
企业AI落地:从RAG到AgentRAG的技术跃迁
java·人工智能·人工智能ai大模型应用