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類成功注入!

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM