Question - Differentiate between constructor injection and setter injection.
Answer -
Constructor Injection vs Setter Injection
Constructor Injection | Setter Injection |
There is no partial injection. | There can be partial injection. |
It doesn’t override the setter property. | It overrides the constructor property. |
It will create a new instance if any modification is done. | It will not create new instance if any modification is done. |
It works better for many properties. | It works better for few properties. |