为什么80%的码农都做不了架构师?>>>   

本文主要研究一下spring-boot-starter-data-redis的配置变更

配置变更

以前是spring-boot的1.4.x版本的(spring-data-redis为1.7.x版本),最近切到2.0.4.RELEASEB版本(spring-data-redis为2.0.5.RELEASE版本),发现配置有变更。

旧版配置

spring.redis.database=0
spring.redis.host=192.168.99.100
spring.redis.port=6379
#spring.redis.password= # Login password of the redis server.
spring.redis.pool.max-active=8
spring.redis.pool.max-idle=8
spring.redis.pool.max-wait=-1
spring.redis.pool.min-idle=0
#spring.redis.sentinel.master= # Name of Redis server.
#spring.redis.sentinel.nodes= # Comma-separated list of host:port pairs.
spring.redis.timeout=10

新版本配置

spring.redis.database=0
spring.redis.host=192.168.99.100
spring.redis.port=6379
#spring.redis.password= # Login password of the redis server.
spring.redis.lettuce.pool.max-active=8
spring.redis.lettuce.pool.max-idle=8
spring.redis.lettuce.pool.max-wait=-1ms
spring.redis.lettuce.pool.min-idle=0
#spring.redis.sentinel.master= # Name of Redis server.
#spring.redis.sentinel.nodes= # Comma-separated list of host:port pairs.
spring.redis.timeout=100ms

小结

新版spring-boot-starter-data-redis有几个变更如下:

  • spring.redis底下除了公共的配置外,区分两个不同的实现,jedis及lettuce
  • 公共配置spring.redis.timeout的参数改为Duration类型,需要增加时间单位参数
  • spring-boot-starter-data-redis新版默认是使用lettuce
  • redis连接池需要引入commons-pool2类库,由于该类库新版本的一些核心类有变动,因此需要注意下版本号,超过2.4.3版本的可能会有问题

doc

  • spring data redis reference

转载于:https://my.oschina.net/go4it/blog/1943985

聊聊spring-boot-starter-data-redis的配置变更相关推荐

  1. 聊聊 Spring Boot 2.x 那些事儿

    本文目录: 即将的 Spring 2.0 - Spring 2.0 是什么 - 开发环境和 IDE - 使用 Spring Initializr 快速入门 Starter 组件 - Web:REST ...

  2. 一个项目有两个pom_实现一个Spring Boot Starter超简单,读 Starter 源码也不在话下...

    Spring Boot 对比 Spring MVC 最大的优点就是使用简单,约定大于配置.不会像之前用 Spring MVC 的时候,时不时被 xml 配置文件搞的晕头转向,冷不防还因为 xml 配置 ...

  3. Spring Boot中使用Redis数据库

    Spring Boot中除了对常用的关系型数据库提供了优秀的自动化支持之外,对于很多NoSQL数据库一样提供了自动化配置的支持,包括:Redis, MongoDB, Elasticsearch, So ...

  4. 《SpringCloud超级入门》Spring Boot Starter的介绍及使用《七》

    目录 Spring Boot Starter项目创建 自动创建客户端 使用 Starter 使用注解开启 Starter 自动构建 使用配置开启 Starter 自动构建 配置 Starter 内容提 ...

  5. 实现一个 Spring Boot Starter 原来如此简单,读 Starter 源码也不在话下

    我是风筝,公众号「古时的风筝」,一个在程序圈混迹多年,主业 Java,另外 Python.React 也玩儿的 6 的斜杠开发者.现已转行程序员鼓励师 Spring Cloud 系列文章已经完成,可以 ...

  6. 手把手教你定制标准 Spring Boot starter

    点击上方蓝色"程序猿DD",选择"设为星标" 回复"资源"获取独家整理的学习资料! 写在前面 我们每次构建一个 Spring 应用程序时,我 ...

  7. 自定义 Spring Boot Starter

    一.引言 什么是Spring Boot Starter呢?我们直接来看看官网是怎么介绍的吧. Starters are a set of convenient dependency descripto ...

  8. Spring boot starter

    1:Spring boot starter及项目中的类似运用 1:Spring boot starter的两种方式 引入pom文件,自动管理jar版本 根据spring.factories配置文件,加 ...

  9. Spring Boot之基于Redis实现MyBatis查询缓存解决方案

    转载自 Spring Boot之基于Redis实现MyBatis查询缓存解决方案 1. 前言 MyBatis是Java中常用的数据层ORM框架,笔者目前在实际的开发中,也在使用MyBatis.本文主要 ...

  10. 聊聊 Spring Boot 2.0 的 WebFlux

    https://zhuanlan.zhihu.com/p/30813274 首发于极乐科技 写文章登录 聊聊 Spring Boot 2.0 的 WebFlux 泥瓦匠BYSocket 4 个月前 聊 ...

最新文章

  1. JSTL 读取数组 和 字符串连接
  2. 枚举 ---- B. Power Sequence[Codeforces Round #666 (Div. 2)][暴力]
  3. postgresql 编码_开源力量与职业发展 --写给对PostgreSQL有志趣的朋友们
  4. python3 requests content和text 区别
  5. golang 返回值报错 cannot use nil as type string in return argument
  6. ros订阅相机深度信息_一起做ROS-DEMO系列 (2):基于find_object_2d的目标匹配识别
  7. mqtt js 中乱码_mqtt之上RRPC同步调用实战
  8. 什么是以太网光纤收发器,其产品特点和技术参数都有哪些?
  9. Linux常用开发环境软件-redis安装
  10. 18.QT-QPlainEdit 信号与槽
  11. C语言 共用体/联合体 union
  12. mysql in 通配符_mysql必知必会--用通配符进行过滤
  13. 《那些年啊,那些事——一个程序员的奋斗史》——37
  14. C# 使用AutoResetEvent进行线程同步
  15. 富文本_富文本原理了解一下?
  16. H264数据格式解析
  17. 毛伟:重塑网络根基——国际形势使然,技术升级必然
  18. linux-巴斯勒相机 GigE通信配置步骤
  19. Facebook登陆错误Invalid Scopes
  20. 著名的php项目,PHP著名开源项目汇总

热门文章

  1. pythonmatplotlib刷新_matplotlib:如何刷新figure.canvas
  2. windows系统磁盘使用记录(自用)
  3. Ripro主题X系列站长素材下载网站模板
  4. Microsoft Enterprise Library 5.0 系列(四) Logging Application Block
  5. Enterprise Library v5.0 -- Data Access Application Block 开发向导(3)
  6. Linux Shell脚本入门教程系列之(六)Shell数组
  7. CSS3 Flex 弹性布局用法详解
  8. Robust Regression_2016_鲁棒回归推导
  9. 小顶堆数据结构C/C++代码实现
  10. 在pycharm中导入anaconda的库