博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
spring boot redis 自定义序列化方式(fastJson)
阅读量:7232 次
发布时间:2019-06-29

本文共 672 字,大约阅读时间需要 2 分钟。

@Configurationpublic class RedisConfig {    @Bean    public RedisSerializer fastJsonJsonRedisSerializer() {        return new FastJsonRedisSerializer(Object.class);    }    @Bean    public RedisTemplate initRedisTemplate(RedisConnectionFactory redisConnectionFactory, RedisSerializer fastJsonJsonRedisSerializer) throws Exception {        RedisTemplate redisTemplate = new RedisTemplate();        redisTemplate.setConnectionFactory(redisConnectionFactory);        redisTemplate.setValueSerializer(fastJsonJsonRedisSerializer);        redisTemplate.setKeySerializer(new StringRedisSerializer());        redisTemplate.afterPropertiesSet();        return redisTemplate;    }}

转载地址:http://ofvfm.baihongyu.com/

你可能感兴趣的文章
Shader 动画
查看>>
Android 多进程通信之几个基本问题
查看>>
在Windows上如何安装和彻底卸载Adobe Flash Player教程
查看>>
五大JAVA Web框架的优缺点对比Spring MVC领先
查看>>
iOS开发技巧-UIImageView 的contentMode属性说明和使用
查看>>
Vue-Router源码分析之index.js
查看>>
Flutter项目之app升级方案
查看>>
dispatch_async和dispatch_sync的区别
查看>>
[翻译] 调试 Rxjs(一):工具
查看>>
前端工程师面试工作分析
查看>>
使用puppeteer爬取网站,抓出404无效链接
查看>>
Android设计模式探讨 Builder模式
查看>>
《讲个故事》GitHub与新人类
查看>>
Kotlin知识点总结与初写时的一些建议
查看>>
通过一个小实例串联webpack+react的使用(入门篇)
查看>>
华山论剑之浅谈iOS的JSpatch(热更新)
查看>>
node扩展 memwatch分析
查看>>
ejs模板引擎原理
查看>>
以太坊构建DApps系列教程(八):启动StoryDAO
查看>>
ES6系列--6. 数组的扩展
查看>>