Quote

We are what we repeatedly do. Excellence, therefore,is not an act but a habit.

Aristotle

Wednesday, January 6, 2010

Constructor Argument Resolution - Spring Framework

Construction argument resolution matching occurs using the argument’s type. If there is no ambiguity in the constructor argument of the bean definition then the order in which the constructor arguments are supplied would be instantiated to the constructor.
____________________________________________________________________________________

<beans>

<bean name="foo" class="x.y.Foo">

<constructor-arg><bean class="x.y.Bar"/>

</constructor-arg><constructor-arg><bean class="x.y.Baz"/>

</constructor-arg></bean>

</beans>

package x.y;

public class Foo {

public Foo(Bar bar, Baz baz) {

// ...

}

}


____________________________________________________________________________________

No comments:

Post a Comment