springboot 2.12版本 项目不能注入RedisTemplate Bean问题

 在springboot项目中,需要使用RedisTemplate类时,提示不能够自动注入,

项目中在引入RedisTemplate类时,引入的jar包依赖为:

1      <dependency>
2             <groupId>org.springframework.data</groupId>
3             <artifactId>spring-data-redis</artifactId>
4 <!--            <version>2.1.4.RELEASE</version>-->
5         </dependency>

将依赖更改为:

  <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-redis</artifactId>
        </dependency>

RedisTemplate类成功注入!

 

posted @ 2020-04-16 14:51  o_osky  阅读(1063)  评论(2编辑  收藏  举报