修改Spring Boot Data Redis 默认客户端为Redis

Spring Boot Data Redis 与 Jedis

Spring Boot Data Redis 默认依赖 lettuce

Spring Boot Data Redis依赖于Jedis或lettuce,本质是对redis客户端们的封装,提供一套与客户端无关的api以提供使用,从而可以轻松将一个redis切换到另一个客户端,而不需要修改业务代码

修改pom.xml文件


<dependency>
    <groupId>org.springframework.bootgroupId>
    <artifactId>spring-boot-starter-data-redisartifactId>
    <exclusions>
        <exclusion>
            <groupId>io.lettucegroupId>
            <artifactId>lettuce-coreartifactId>
        exclusion>
    exclusions>
dependency>


<dependency>
    <groupId>redis.clientsgroupId>
    <artifactId>jedisartifactId>
    <version>2.9.1version>
dependency>

问题集

Caused by: java.lang.ClassNotFoundException: redis.clients.util.Pool

<dependency>
    <groupId>redis.clientsgroupId>
    <artifactId>jedisartifactId>
    <version>2.9.1version>
dependency>

你可能感兴趣的:(Java进化之旅,Spring,Boot)