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

    }

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

相关推荐
2301_76347246几秒前
C++中的享元模式高级应用
开发语言·c++·算法
我真的是大笨蛋1 分钟前
MVCC解析
java·数据库·spring boot·sql·mysql·设计模式·设计规范
不会代码的小测试2 分钟前
UI自动化-针对验证码登录的系统,通过首次手动登录存储cookie的方式后续访问免登录方法
开发语言·python·selenium
weixin_458923203 分钟前
分布式日志系统实现
开发语言·c++·算法
秃头续命码农人3 分钟前
谈谈对Spring、Spring MVC、SpringBoot、SpringCloud,Mybatis框架的理解
java·spring boot·spring·mvc·maven·mybatis
ahauedu6 分钟前
SpringBoot 3.5.10引入springdoc-openapi-starter-webmvc-ui版本
java·spring boot·后端
我是咸鱼不闲呀6 分钟前
力扣Hot100系列15(Java)——[二叉树]总结(有效的括号,最小栈,字符串解码,每日温度,柱状图中最大的矩形)
java·算法·leetcode
开发者小天10 分钟前
python中calss的用法
开发语言·python
沉默-_-13 分钟前
MyBatis 学习笔记
java·开发语言·tomcat
未来龙皇小蓝14 分钟前
Spring内置常见线程池配置及相关概念
java·后端·spring·系统架构