The injection point has the following annotations: - @org.springframework.beans.factory.annotation.
啟動Springboot專案失敗。Error Description:
Field “redisTemplate” in com.example.controller.HttpController required a bean of type ‘org.springframework.redis-core.ReidsTemplate’ that could not be found.
The injection point has the following annotations:
- @org.springframework.beans.factory.annotation.Autowired(required=true)
Action:
Consider defining a bean of type 'org.springframework.redis-core.ReidsTemplate ’ in your configuration.
但是看了bean的注入是沒有問題的。如下自動注入:
@Autowired
redisTemplae<String LIst> RedisTemplate;
思考:這個報錯不是RedisTemplate的jar包匯入的問題;
是向IOC容器中注入redisTemplate物件時產生的錯誤。因此嘗試將宣告時的泛型去掉:
@Autowired
redisTemplae RedisTemplate;
後再此啟動專案,正常啟動。
總結:在使用@Autowired自動注入,特別是被注入的物件型別是匯入的第三方Class或介面,非自定義的介面時,不要擅自新增泛型。。極容易產生上面的報錯。可以使用型別強轉代替泛型的使用:
List<ProjectVo> list = (List<ProjectVo>) redisTemplate.opsForValue().get("hotProjectList");
相關文章
- 10-Overview-AnnotationsView
- False SQL Injection and Advanced Blind SQL InjectionFalseSQL
- MongoDB, no SQL injection?MongoDBSQL
- RESTORE POINTREST
- SQL Injection via DNSSQLDNS
- Injection of autowired dependencies failed;AI
- 深入淺出Android Support AnnotationsAndroid
- Android Support Annotations 使用詳解Android
- JavaScript some pointJavaScript
- study critical point and saddle point using Hessian Matrix
- Hacking Oracle with Sql InjectionOracleSQL
- SQL注射/SQL Injection漏洞SQL
- This page provides the following types of documentationIDE
- 細說 Android Annotations 註解框架Android框架
- jQuery has()jQuery
- jQuery :has()jQuery
- oracle hasOracle
- Windows Dll Injection、Process Injection、API Hook、DLL後門/惡意程式入侵技術WindowsAPIHook
- Appdash原始碼閱讀——Annotations與EventAPP原始碼
- 使用 iBatis (MyBatis)的元註解AnnotationsMyBatis
- SMON Following Errors ORA-21779Error
- use multiple tablespaces to perform the following tasks (47)ORM
- Drupal - pre Auth SQL Injection VulnerabilitySQL
- Powershell tricks::Code Execution & Process Injection
- PHP WDDX Serializier Data Injection VulnerabilityPHP
- Drupal 7.31 SQL Injection ExpSQL
- AttributeError: 'dict' object has no attribute 'has_key'ErrorObject
- Windows Embedded for Point of Service概述Windows
- [CSS 3] :has()CSS
- 題解:UVA124 Following Orders
- Android App Injection&&Drozer UseAndroidAPP
- ecshop /flow.php SQL Injection VulPHPSQL
- ecshop /search.php SQL Injection VulPHPSQL
- ecshop /category.php SQL Injection VulGoPHPSQL
- discuz /faq.php SQL Injection VulPHPSQL
- ecshop /goods.php SQL Injection VulGoPHPSQL
- Windows Embedded for Point of Service 益處Windows
- 收藏What’s the Point of Oracle Checkpoints?Oracle