![](/img/trans.png)
[英]@Autowired bean is null when referenced in the constructor of another bean
[英]@Autowired bean is null when referenced in the constructor
當我從構造函數中引用bean時,它為null,但是從另一個方法中引用時,它就很好。
要在構造函數中引用Bean,您需要
@Autowired
注釋構造函數 如果您共享一些示例代碼,則可以診斷更多細節。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.