1. 程式人生 > >關於spring boot應用自動注入出現Consider defining a bean of type 'xxx' in your configuration問題解決方案

關於spring boot應用自動注入出現Consider defining a bean of type 'xxx' in your configuration問題解決方案

在做spring cloud的hystrix的時候,寫了一個controller,注入內部類時發生了一個錯誤:

看起來就是找不到這個類,問題是我已經寫了這個類:


百度後發現有發生同樣問題的童鞋,原來問題出在application類的註解@SpringBootApplication上,


簡單的解決辦法,就是在ConsumerService上加上@Service註解,讓spring能夠掃到。

問題解決,參考部落格:https://blog.csdn.net/a532672728/article/details/77702772

相關推薦

關於spring boot應用自動注入出現Consider defining a bean of type 'xxx' in your configuration問題解決方案

在做spring cloud的hystrix的時候,寫了一個controller,注入內部類時發生了一個錯誤:看起來就是找不到這個類,問題是我已經寫了這個類:百度後發現有發生同樣問題的童鞋,原來問題出在application類的註解@SpringBootApplication

關於spring boot自動注入出現Consider defining a bean of type 'xxx' in your configuration問題解決方案

轉載自:   搭建完spring boot的demo後自然要實現自動注入來體現spring ioc的便利了,但是我在實施過程中出現了這麼一個問題,見下面,這裡找到解決辦法記錄下來,供遇到同樣的問題的同僚參考    Description: Field hel

SpringBoot報Consider defining a bean of typexxxin your configuration怎麼解決

今天再跑SpringBoot專案時,在新加入SpringSecurity的時候,專案一直報錯,跑不起來,報錯原因如下: 報錯的原因就是因為我引入的PasswordEncoder沒有被注入到spring bean容器,導致無法啟動,所以我們需要手動就PasswordEncoder注入到bea

處理異常:Consider defining a bean of type 'xxx' in your config

@SpringBootApplication(scanBasePackages = {"com.dk.d.database.service.*","com.dk.d.database.repositor

關於spring boot自動注入出現Mapper Consider defining a bean of type 'xxx' in your configuration問題解決方案

問題: Mapper註解不能被識別, Consider defining a bean of type 'XXX' in you configuration 參考其他部落格得到如下解決辦法: 在指定的application類上加上這麼一行註解,手動指定application類要

Spring Boot:Action:Consider defining a bean of type '*.*.*' in your configuration解決方案

rri framework 成功 ould script ota http per apache   果然不看教程直接使用在遇到問題會懵逼,連解決問題都得搜半天還不一定能幫你解決了。。。 ***************************APPLICATION FAIL

Spring BootConsider defining a bean of type '*.*.Dao' in your configuration解決方案

SpringBoot在啟動專案的時候遇到了以下情況: APPLICATION FAILED TO START *************************** Description: Field sysUserDao in com.iamapsycho.service.imp

Spring BootConsider defining a bean of type '*.*.*' in your configuration解決方案

  果然不看教程直接使用在遇到問題會懵逼,連解決問題都得搜半天還不一定能幫你解決了。。。 ***************************APPLICATION FAILED TO START***************************Description:Field mapper in c

springboot Consider defining a bean of type 'xxx' in your configuration

bubuko post mil ini 分享 cat bsp ring fig 這個錯誤是service的bean註入失敗,主要是Application位置不對,要保證項目中的類在Application啟動服務器類的下一級目錄,如圖: springboot Consi

啟動項目,編譯報錯:Consider defining a bean of type 'XXX' in your configuration.

定義 多個 ica 錯誤 stc 就是 dea component 查看 在controller層註入ConfigBean,編譯器報錯: 一開是以為是intellij idea 的告警級別設定的問題,就沒有在意,繼續啟動項目,結果控制臺報錯:Consider defi

Consider defining a bean of type 'xx.xx.dao.UserDao' in your configuration.

首先因為沒配資料來源的問題在Application啟動類上加了@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class}),解決啟動報錯的問題,後來資料來源配好忘了去掉,所以後來變報了

springBoot中引用redis報錯, Consider defining a bean of type 'org.springframework.data.redis.core.RedisTem

我們在springboot中經常引用redis,因為springBoot中自帶了許多起步依賴,我們不要給他加入自己的版本號,要不然很容易造成版本號衝突,導致redis引入不進來,報 Consider defining a bean of type 'org.springfra

Consider defining a bean of type 'com.pty.es.api.ArticleSearchRepository' in your configuration.問題解決

一: 真正原因: pty的maven下面匯入了com.pty.api等等的jar包 之前的專案groupId是pty所以打成包放在了pty的maven下面 所以: 選中pty-elasticsearch和pty 首先 刪除maven庫中的對應目錄的jar包 然後 Run as –

踩坑: springboot專案整合mongodb, 報Consider defining a bean of type com.xxRepository'in your configuration.

踩坑背景:  專案採用gradle分散式開發,現如今產品需要新增新功能,新功能我這邊準備開啟一個新的module來進行開發,在原來的基礎上開發出一個新的模組,一切依賴都搞定後,程式碼也寫了,就啟動準備測試一下,結果發現專案居然報錯.啟動不起來. 如上圖,直接報錯,一看是Acti

Consider defining a bean of type 'com.lvjing.dao.DeviceStatusMapper' in your configuration.

exceptio can plugin spring ould tac glib pre scripts "C:\Program Files\Java\jdk1.8.0_181\bin\java.exe" "-javaagent:C:\Program Files\JetBr

SpringBoot整合Mybatis報錯:Consider defining a bean of type 'xx.xx.xx' in your configur

SpringBoot和mybatis整合完後,如果按照spring的整合習慣,可能會發現一個錯誤: APPLICATION FAILED TO START **********************

Consider defining a bean of type 'org.springframework.web.client.RestTemplate' in your configuration

如題,在springcloud開發中,當我們將RestTemplate通過@Autowired註解注入到一個類中,啟動服務報錯。 在springboot1.3版本中會預設提供一個RestTemplate的例項Bean,當在springboot1.4以及以後的版本中,需要手動

Spring Boot無法自動注入bean問題解決方案

前言:在使用Spring Boot+Mybatis時,寫完Mapper介面、Service、Controller後,啟動(圖1)打包專案(圖2)均失敗,提示無法自動注入bean。完成目標:1、無法自動注入bean錯誤資訊2、程式碼展示3、解決方案一、錯誤資訊:Descript

關於spring boot無法自動注入bean問題解決方案

. ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_|

spring boot無法自動注入bean?原因在這兒

Description: Field helloSpringBootService in com.zd.hellospringboot.HelloController required a bean of type 'com.zd.service.HelloSpringBo