In this paper, we look at the configuration changes spring-boot-starter-data-redis of
Configuration changes
Previous version 1.4.x is a spring-boot (spring-data-redis version of 1.7.x), recently cut to 2.0.4.RELEASEB version (spring-data-redis version of 2.0.5.RELEASE), arranged found there is a change.
Legacy Configuration
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
The new configuration
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
summary
The new spring-boot-starter-data-redis There are a few changes as follows:
- In addition to the public under spring.redis arranged to distinguish two different implementations, jedis and lettuce
- Spring.redis.timeout common configuration parameters changed Duration type, need to increase the time the unit parameters
- spring-boot-starter-data-redis default is to use the new version of lettuce
- redis connection pool needs to be introduced commons-pool2 library, since the new version of the library some core classes are subject to change and therefore need to pay attention to the version number, 2.4.3 version than there may be a problem