Followers

springIOC : Difference between constructor and setter injection


S.No
Constructor Injection
Setter Injection
1
No Partial Injection
Partial Injection is possible
2
Doesn't override the setter property
Overrides the constructor property if both are defined.
3
Creates new instance if any modification occurs
Doesn't create new instance if you change the property value
4
Better for too many properties
Better for few properties.

No comments:

Post a Comment