spring下bean繼承另一個bean導致No qualifying bean of type錯誤。
前言
在spring下面假如你定義了自動掃描:
然後,service長這樣:
biz繼承了service:
執行時候你會發現:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name '/admin/account/Member': Unsatisfied dependency expressed through field 'service'; nested exception is org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type 'net.w2p.DevBase.service.account.MemberService' available: expected single matching bean but found 2: memberService,memberBiz
好了,這個怎麼會出現呢,搞不好是spring看在繼承份上連父親節點也一併初始化了,原本就有父類了。。
解決方案:
推薦的是:
所以,加一個primary即可:
相關推薦
spring下bean繼承另一個bean導致No qualifying bean of type錯誤。
前言 在spring下面假如你定義了自動掃描: 然後,service長這樣: biz繼承了service: 執行時候你會發現: org.springframework.beans.factory.UnsatisfiedDependencyException
關於在一個頁面的div巢狀另一個頁面導致下拉框失效的問題
做後臺管理頁面,在一個主頁面中巢狀另一個頁面,通過主頁面點選不同選單,在頁面另一部分顯示不同的子頁面,知道有兩種方法: 1.使用<iframe>視窗; 2.在主頁面的div裡面巢狀一個子頁面,$("#divId").load("XXX.jsp"). 在用第二個方
spring註入時報錯::No qualifying bean of type 'xxx.xxMapper'
and class can 解決 base ica fail pri exception 做一個小項目,因為有 baseService,所以偷懶就沒有寫單獨的每個xxService接口,直接寫的xxServiceImpl,結果在service實現類中註入Mapper的時
spring異步執行報異常No qualifying bean of type 'org.springframework.core.task.TaskExecutor' available
sun type determine ext tde dap 查找 ann def 最近觀察項目運行日誌的時候突然發現了一個異常, [2018-04-03 10:49:07] 100.0.1.246 http-nio-8080-exec-9 DEBUG org.sprin
Jboot v1.7.5 釋出,Spring Cloud 之外的另一個選擇
Jboot 是一個基於 JFinal 和 Undertow 開發的微服務框架。提供了 AOP、RPC、分散式快取、限流、降級、熔斷、統一配置中心、Opentracing 資料追蹤、metrics 資料監控、分散式 session、程式碼生成器、shiro 和 jwt 安全
【Spring 定時器】定時器 No qualifying bean of type [org.springframework.scheduling.TaskScheduler] is defined
stackoverflow 版 http://stackoverflow.com/questions/31199888/spring-task-scheduler-no-qualifying-bean-of-type-org-springframework-sche
【Spring 定時器】Spring 定時器 No qualifying bean of type [org.springframework.scheduling.TaskScheduler]
Spring 定時器 No qualifying bean of type [org.springframework.scheduling.TaskScheduler] is defined 最近專案裡面,用了spring的定時任務,一直以來,專案執行的不錯。定時器
springBoot專案解決spring自帶定時任務No qualifying bean異常
問題展示 org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.scheduling.TaskSche
spring 報錯 No qualifying bean of type
報錯如下 --------------------------------------------- 嚴重: StandardWrapper.Throwable org.springframework.beans.factory.BeanCreationException: Error cr
Eclipse 下如何引用另一個專案的Java檔案
有關聯的2個專案,有些類是相同的。例如實體類。 如果你採用 Ctrl + C & Ctrl + V 的方式,以後再有改動,2個專案就都需要改動。 怎樣才能只改動一個呢? 答案就是,在一個專案(專案A)中引用另一個專案(專案B)。 右鍵 專案A,點選 Propert
關於 SpringMvc+Mybatis專案的No qualifying bean of type org.mybatis.spring.SqlSessionTemplate
專案啟動時,控制檯輸出No qualifying bean of type org.mybatis.spring.SqlSessionTemplate...且提示某某Dao 註解失敗,某某srevice註解失敗。原因:1:檢查配置檔案中註解掃描路徑是否正確 如:appli
Spring No qualifying bean of type錯誤
No qualifying bean of type [xx.xxx.xxx.xxDao] dound for dependency: expected at least 1 bean which qualifies as autowire candidate
Spring 定時器 No qualifying bean of type [org.springframework.scheduling.TaskScheduler] is defined
最近專案裡面,用了spring的定時任務,一直以來,專案執行的不錯。定時器也能正常使用。可是,今天啟動專案測試的時候,盯著啟動Log看了一陣子,突然間發現,啟動的Log中居然有一個異常,雖然一閃而過,但是那熟悉的異常格式還是讓我渾身一顫。這個專案一直執行的很好啊,沒發現有什
No qualifying bean of type報錯問題處理
ted don mon ref scan getbean metadata .get 一個 org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of typ
[java]No qualifying bean of type 解決方法
1.錯誤原因:註解寫錯 2.原理如下: 現在的spring早就已經擺脫了之前一堆xml配置檔案的情況,都是通過註解配置的方式進行依賴注入了,通常情況下,我們會有一個配置類,然後通過AnnotationConfigApplicationContext進行載入 AnnotationCo
No qualifying bean of type
這種找不到bean的錯誤,兩種情況,一是xml配置的掃描路徑有誤,沒掃到。二是註解有錯誤,缺失了 @service或者其他註解 這裡是因為 裡面的IMessageService 的實現類 缺少了@Serv
factory.NoSuchBeanDefinitionException: No qualifying bean of type
我的錯誤原因是 自己 引用了自己 Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.moneyP2P.p2p.VSFP.spring.serv
新下載的工程,啟動tomcat出現識別檔案失敗的現象。No qualifying bean of type 'com.kanq.platform.cert.mapper.CertificateSjdr
首選檢查下資料庫配置: 問題資訊描述如下: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with nam
No qualifying bean of type 'javax.sql.DataSource' available: more than one 'primary' bean found amon
多資料來源報錯:No qualifying bean of type 'javax.sql.DataSource' available: more than one 'primary' bean found among candidates: [test2DataSource, te
品優購專案異常No qualifying bean of type [org.springframework.data.redis.core.RedisTemplate] found for depe
報錯 嚴重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.sprin