, Employee, , bean xml.
<bean id="qualification" class="com.Autowiring.constructor.Qualification">
<property name="highestQualification" value="BTech"/>
<property name="certifcations" value="SCJP"/>
</bean>
<bean name="address" class="com.Autowiring.constructor.Address">
<property name="city" value="Bangalore" />
<property name="zip" value="560054" />
<property name="building" value="Building One" />
</bean>
4 . , , , , , id, name, dob, address qualification.
// - 1
public Employee(Address address, Qualification qualification) {
super();
System.out.println(1);
this.address = address;
this.qualification = qualification;
}
// - 2
public Employee(Qualification qualification) {
super();
System.out.println(2);
this.qualification = qualification;
}
// - 3
public Employee(Address address) {
super();
System.out.println(3);
this.address = address;
}
// - 4
public Employee(int id, String name, Date dob, Address address,
Qualification qualification) {
super();
System.out.println(4);
this.id = id;
this.name = name;
this.dob = dob;
this.address = address;
this.qualification = qualification;
}
Case-1: , 1 4 , -arg bean.
: 3 , , 2 3.
Case-2: , 4 , -arg bean.
. 1, , bean, 1.
Case-3. , -arg bean.
. 1, , bean, 1, 4- , id, name dob bean, - , , bean.
Case-4. , -arg employee bean, .
. 4- , , , dob, bean, 1- arg bean, 4- , , , 4- .
: , spring , , .