1 Answer

0 votes
by

In constructor injection, partial injection is not allowed whereas it is allowed in setter injection.

The constructor injection doesn’t override the setter property whereas the same is not true for setter injection.

Constructor injection creates a new instance if any modification is done. Creation of new instance is not possible in setter injection.

In case the bean has many properties, then constructor injection is preferred. If it has few properties, then setter injection is preferred.

Related questions

0 votes
asked Apr 4, 2021 in Spring by Robindeniel
0 votes
asked Apr 4, 2021 in Spring by Robindeniel
...