gudii9
asked on
Constructor injection
I was reading folowing lines and I did not understand clearly.
If a constructor takes two,more parameters of the same type, it may be
difficult to determine what each parameters purpose is.
Constructor injection does not lend itself readily to inheritance. A beans
constructor will have to pass parameters to super() in order to set private
properties in the parent object.
Any ideas, resources,sample code,links, highly appreciated. thanks in advance.
If a constructor takes two,more parameters of the same type, it may be
difficult to determine what each parameters purpose is.
Constructor injection does not lend itself readily to inheritance. A beans
constructor will have to pass parameters to super() in order to set private
properties in the parent object.
Any ideas, resources,sample code,links, highly appreciated. thanks in advance.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
>> constructor will have to pass parameters to super() in order to set private
>> properties in the parent object.
If there is any parent class, then while creation, it is very obvious that we should call super() with the required parameter.
On the other hand, setXXXX methods works without need of any super()