課程
/后端開發
/Java
/Spring入門篇
為什么每個類只能有一個構造器被標記為required=true????????????????
2016-05-05
源自:Spring入門篇 4-2
正在回答
規定的吧,如果設置兩個構造函數required=true運行會出現下列錯誤
Invalid autowire-marked constructor: public com.imooc.beanannotation.jsr.JsrServie(). Found another constructor with 'required' Autowired annotation: public com.imooc.beanannotation.jsr.JsrServie(com.imooc.beanannotation.jsr.JsrDAO)
java家洼 提問者
舉報
為您帶來IOC和AOP的基本概念及用法,為后續高級課程學習打下基礎
1 回答構造注入時有多個構造器 怎樣才能找到是那個構造器呢?
2 回答為什么我更改構造器形參不會報錯?為什么老師的能報錯
1 回答為什么用構造器自動裝配會報錯
3 回答為什么service中構造器方法的sysout的內容沒顯示?
3 回答為什么使用Required注解會有異常?
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網安備11010802030151號
購課補貼聯系客服咨詢優惠詳情
慕課網APP您的移動學習伙伴
掃描二維碼關注慕課網微信公眾號
2016-05-05
規定的吧,如果設置兩個構造函數required=true運行會出現下列錯誤
Invalid autowire-marked constructor: public com.imooc.beanannotation.jsr.JsrServie(). Found another constructor with 'required' Autowired annotation: public com.imooc.beanannotation.jsr.JsrServie(com.imooc.beanannotation.jsr.JsrDAO)