当前位置: 首页 > news >正文

中国建设银行官网站汽车卡竞价sem托管

中国建设银行官网站汽车卡,竞价sem托管,公司网站开发建设费用,如何改变网站首页栏目天行健,君子以自强不息;地势坤,君子以厚德载物。 每个人都有惰性,但不断学习是好好生活的根本,共勉! 文章均为学习整理笔记,分享记录为主,如有错误请指正,共同学习进步。…

天行健,君子以自强不息;地势坤,君子以厚德载物。


每个人都有惰性,但不断学习是好好生活的根本,共勉!


文章均为学习整理笔记,分享记录为主,如有错误请指正,共同学习进步。

Redis配置类

  • Redis配置类1
  • Redis配置类2


在使用redis时,会用到RedisTemplate工具,需要配置配置类,以此来连接工厂、序列化存入的键值。
这里配置了两个不同的配置类,内容大致形同,细节略有不同,可挑选使用。

Redis配置类1

具备:序列化、工厂连接、键值字符串序列化、hash键值字符串序列化

package com.data.config;import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.RedisSerializer;
import org.springframework.data.redis.serializer.StringRedisSerializer;/*** @ClassDescription:* @Author:李白* @Date:2023/7/25 14:44*/
@Configuration
public class RedisTemplateConfig {@Bean(name = "redisTemplate")public RedisTemplate redisTemplate(RedisConnectionFactory factory){System.out.println("redis序列化-->");RedisTemplate redisTemplate = new RedisTemplate();RedisSerializer redisSerializer = new StringRedisSerializer();//连接工厂redisTemplate.setConnectionFactory(factory);//键序列化redisTemplate.setKeySerializer(redisSerializer);//值序列化redisTemplate.setValueSerializer(redisSerializer);//key hashMap序列化redisTemplate.setHashKeySerializer(redisSerializer);//value hashMap序列化redisTemplate.setHashValueSerializer(redisSerializer);return redisTemplate;}}

Redis配置类2

具备:序列化、工厂连接、键值序字符串列化、hash键值Json序列化

package com.data.config;import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.PropertyAccessor;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
import org.springframework.data.redis.serializer.StringRedisSerializer;/*** @ClassDescription:* @Author:李白* @Date:2023/7/25 14:44*/
@Configuration
public class RedisTemplateConfig {@Bean@SuppressWarnings("all")public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory factory) {RedisTemplate<String, Object> template = new RedisTemplate<String, Object>();template.setConnectionFactory(factory);Jackson2JsonRedisSerializer jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer(Object.class);ObjectMapper om = new ObjectMapper();om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);jackson2JsonRedisSerializer.setObjectMapper(om);StringRedisSerializer stringRedisSerializer = new StringRedisSerializer();// key采用String的序列化方式template.setKeySerializer(stringRedisSerializer);// hash的key也采用String的序列化方式template.setHashKeySerializer(stringRedisSerializer);// value序列化方式采用jacksontemplate.setValueSerializer(jackson2JsonRedisSerializer);// hash的value序列化方式采用jacksontemplate.setHashValueSerializer(jackson2JsonRedisSerializer);template.afterPropertiesSet();return template;}}

http://www.yayakq.cn/news/90799/

相关文章:

  • 社交网站是怎么做的wordpress会员内容
  • 游民星空是谁做的网站wordpress插件 占用内存
  • 门业东莞网站建设技术支持网站建设分析案例
  • 网站备案网站前置审批免费素材视频网站
  • ps临摹网站php网站方案
  • 网站推广营销应该怎么做wordpress图片专辑
  • 网站建设 镇江万达前端面试
  • 怎么做购物车网站南宁建企业网站
  • 网站常用图片苍南县规划建设局网站
  • 论坛购物网站开发我先做个网站怎么做
  • 网站如何做触屏滑动效果毕节做网站
  • 设计工作网站怎么把网站黑掉
  • 做网站时无法上传图片可以看那种东西的浏览器
  • 网站建设老李教学网站网站会员注册系统源码
  • 有了实名制域名怎么做网站开发公司支付给业主的购房补贴
  • 营销型网站建设供货商高性能网站建设指南pdf
  • 阿里云自助建站模板免费网站制作器
  • 网站建设前期调研公司汇报刚刚大连发生了大事
  • 企业建设网站的预期收益企业网站怎么做的好看
  • 长沙有哪些网站建设公司好做网站需要提供的资料
  • 如何做网站路径分析网站建设技术合同模板
  • 成都p2p网站建设建设网站需要造价
  • 网站模板文件在哪里下载wordpress前端工具箱
  • 云建站微网站网站添加微信
  • 嘉兴网站开发学校大同建设银行保安招聘网站
  • 站点推广促销高端女装品牌前十名
  • 营销型网站建设公司易网拓医疗网站建设 中企动力
  • 一般做门户网站多少钱wordpress 注册功能
  • 制作网页的网站有哪些佛山做外贸网站
  • 站长之家排行榜论坛搭建 wordpress