Order in which fields in a bean are initialized
问题 I have a bean like this: @Component @DependsOn("SomeType") Class A{ @Autowired SomeType one; String two = one.someMethod(); int three; } In my application context xml, I have: <bean id="two" class="a.b.c.SomeType"></bean> <context:component-scan base-package="a.b.c"/> <context:annotation-config/> But while Spring instantiates the bean, it throws a NullPointerException . So I'm wondering if the field two is initialized before field one , causing the NPE. Can anyone tell me in which order