2017-05-04 67 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