亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

報錯Caused by: java.lang.NoSuchMethodException: com.imooc.ioc.injection.service.InjectionServiceImpl.<init>()

在InjectionServiceImpl類里面構造注入和設值注入同時存在,把spring-injection.xml文件中的構造注入配置注釋掉,運行TestInjection類里面的testSetter()設值注入方法,報異常

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'injectionService' defined in class path resource [spring-injection.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.imooc.ioc.injection.service.InjectionServiceImpl]: No default constructor found; nested exception is java.lang.NoSuchMethodException: com.imooc.ioc.injection.service.InjectionServiceImpl.<init>()

http://img1.sycdn.imooc.com//5a24f5da0001333507160498.jpg

http://img1.sycdn.imooc.com//5a24f5db00010acd09520495.jpg


正在回答

2 回答

你在xml文件中用ctrl+鼠標移動到com.imooc....這一塊看一下你的路徑有沒有出錯。

0 回復 有任何疑惑可以回復我~

把構造注入那段代碼注釋掉看看呢?會不會是在getBean的時候構造注入但xml里沒有構造注入的配置造成的

0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

報錯Caused by: java.lang.NoSuchMethodException: com.imooc.ioc.injection.service.InjectionServiceImpl.<init>()

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號