Jedis连接池介绍(可以不排除lettuce依赖包)
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-redis</artifactId> <exclusions> <exclusion> <groupId>io.lettuce</groupId> <artifactId>lettuce-core</artifactId> </exclusion> </exclusions> </dependency> <!--不用指定版本号,本身spring-data-redis里面有--> <dependency> <groupId>redis.clients</groupId> <artifactId>jedis</artifactId> </dependency> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-pool2</artifactId> <version>2.6.1</version> </dependency>
不想排除依赖包,那么就在配置文件中弄也是可以的
spring: redis: host: 81.71.147.62 port: 481000 password: 12233456 #指定redis底层客户端实现 client-type: lettuce lettuce: pool: # 连接池最大连接数(使用负值表示没有限制) max-active: 10 # 连接池中的最大空闲连接 max-idle: 10 # 连接池中的最小空闲连接 min-idle: 0 # 连接池最大阻塞等待时间(使用负值表示没有限制) max-wait: -1ms
重点是这个: client-type: lettuce
本文作者为DBC,转载请注明。