Bean definition
Property:
Class
Name
Scope
Constructor arguments
Properties
Autowiring mode
Lazy-initialization mode
Initialization method
Destruction method
Inner class names
If you want to configure a bean definitionfor a static nested class, you need to use the binary name of the inner class.
For example, if you have a class called Fooin the com.example package, and this Foo class has a static inner class calledBar, the value of the CLASS attribute on a bean definition would be
com.example.Foo$Bar
IOC: inversion of control, the bean itself controlling theinstantiation or location of its dependencies on its own by using directconstruction of classes, or the Service Locator pattern.
Code is cleaner with the dependencyinjection principle and decoupling is more effective when objects are providedwith their dependencies. The object does not look up its dependencies, and doesnot know the location or class of the dependencies. As such, your classesbecome easier to test, in particular when the dependencies are on interfaces orabstract base classes, which allow for stub or mock implementations to be usedin unit tests.
Constructor-baseddependency injection:
Constructor argument resolution
<beans>
<bean id="foo" class="x.y.Foo">
<constructor-arg ref="bar"/>
<constructor-arg ref="baz"/>
</bean>
<bean id="bar" class="x.y.Bar"/>
<bean id="baz" class="x.y.Baz"/>
</beans>
Constructor argument type matchingresolution
<bean id="exampleBean" class="examples.ExampleBean">
<constructor-arg type="int" value="7500000"/>
<constructor-arg type="java.lang.String" value="42"/>
</bean>
Constructor argument index