2017-05-04 63 views
0

使用@Autowired spring註釋的自動裝配是否可以在類初始化時發生,而不僅僅在構造函數調用之前發生?爲幫助在這裏描述Spring類在初始化時自動裝配

+0

可能重複[如何做自動裝配 - 春季工作](http://stackoverflow.com/questions/3153546/how-does-autowiring-work-in-spring) – Sajjad

回答

0

爲了闡明rperes所說的,InjectableBean在構建時被注入,但是如果你沒有配置InjectableBean作爲要注入的組件,那麼你將會遇到問題。

檢查InjectableBean的配置是否正確。看看Spring: Properly setup @ComponentScan