spring异常Unsatisfied dependency expressed through constructor parameter 0

时间:2025-02-16 11:02:04

 

异常信息:

: Error creating bean with name 'xxx' defined in file [G:\MagicMed\SVN\gouxinjie\trunk\procedure\MagicMedEcg\target\MagicMedEcg\WEB-INF\classes\com\magicmed\ecg\common\utils\mqtt\]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is : No qualifying bean of type '' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
	at (:749)
	at (:189)
	at (:1193)
	at (:1095)
	at (:513)
	at (:483)
	at $(:306)
	at (:230)
	at (:302)
10-Sep-2018 18:19:20.631 严重 [RMI TCP Connection(3)-127.0.0.1]  One or more listeners failed to start. Full details will be found in the appropriate container log file
	at (:197)
	at (:761)
10-Sep-2018 18:19:20.633 严重 [RMI TCP Connection(3)-127.0.0.1]  Context [/MagicMedEcg] startup failed due to previous errors
	at (:867)
	at (:543)
	at (:443)
	at (:325)
	at (:107)
	at (:4853)
	at (:5314)
	at (:145)
	at (:753)
	at (:729)
	at (:717)
	at (:1733)
	at .invoke0(Native Method)
	at (:62)
	at (:43)
	at (:498)
	at (:300)
	at (:819)
	at (:801)
	at (:484)
	at (:433)
	at .invoke0(Native Method)
	at (:62)
	at (:43)
	at (:498)
	at (:300)
	at (:819)
	at (:801)
	at (:1468)
	at $300(:76)
	at $(:1309)
	at (:1401)
	at (:829)
	at .invoke0(Native Method)
	at (:62)
	at (:43)
	at (:498)
	at (:324)
	at $(:200)
	at $(:197)
	at (Native Method)
	at (:196)
	at (:568)
	at $ConnectionHandler.run0(:826)
	at $$run$0(:683)
	at (Native Method)
	at $(:682)
	at (:1142)
	at $(:617)
	at (:745)
Caused by: : No qualifying bean of type '' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
	at (:1493)
	at (:1104)
	at (:1066)
	at (:835)
	at (:741)
	... 60 more

 

 

问题解决:由于在类里面定义了“有参构造方法”,这样的话就会覆盖原先的“无参构造方法”,所以会出现此异常,所以在类里面加上“无参构造方法”就完了(折磨了好长时间,特此记录一下)