springboot2.0整合redis报错

Field factory in com.xdd.xdd_commons.config.RedisTemplateConfig required a bean of type 'org.springframework.data.redis.connection.jedis.JedisConnectionFactory' that could not be found 是因为 2.0和1.5x版本的差异问题致使 按照以前的版本配置出错 找不到jedisConnectionFactoryhtml

<!-- Spring Boot Redis依赖 -->
        <!-- 注意:1.5版本的依赖和2.0的依赖不同,注意看哦 1.5我记得名字里面应该没有“data”, 2.0必须是“spring-boot-starter-data-redis” 这个才行-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-redis
            </artifactId>
            <!-- 1.5的版本默认采用的链接池技术是jedis 2.0以上版本默认链接池是lettuce, 在这里采用jedis,因此须要排除lettuce的jar -->
            <exclusions>
                <exclusion>
                    <groupId>redis.clients</groupId>
                    <artifactId>jedis</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>io.lettuce</groupId>
                    <artifactId>lettuce-core</artifactId>
                </exclusion>
            </exclusions>
        </dependency> <!-- 添加jedis客户端 -->
        <dependency>
            <groupId>redis.clients</groupId>
            <artifactId>jedis</artifactId>
        </dependency>
        <!--spring2.0集成redis所需common-pool2-->
        <!-- 必须加上,jedis依赖此 -->
        <!-- spring boot 2.0 的操做手册有标注 你们能够去看看 地址是:https://docs.spring.io/spring-boot/docs/2.0.3.RELEASE/reference/htmlsingle/-->
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-pool2</artifactId>
            <version>2.5.0</version>
        </dependency>
        <!-- 将做为Redis对象序列化器 -->
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>fastjson</artifactId>
            <version>1.2.54</version>
        </dependency>

原文引用地址: http://www.javashuo.com/article/p-wusfjyzh-eg.html 感谢:瘦子没有夏天redis

相关文章
相关标签/搜索