Constructor injection vs Setter injection in Spring Framework

0 votes

Can someone differentiate between constructor injection and setter injection?

Aug 29, 2018 in Java by 93.lynn
• 1,550 points
158 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

Here, I have listed down few differences. Hope it helps.

Constructor Injection

Setter Injection

There is no partial injection.

There can be a 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 a new instance if any modification is done.

It works better for many properties.

It works better for a few properties.

answered Aug 29, 2018 by anto.trigg4
• 3,420 points

Related Questions In Java

0 votes
1 answer

@Component vs @Repository vs @Service in Spring Framework

As you might be knowing, all these ...READ MORE

answered May 29, 2018 in Java by geek.erkami
• 2,320 points
511 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Types of transaction management in Spring Framework

Well there are basically to types of ...READ MORE

answered Nov 27, 2018 in Java by geek.erkami
• 2,320 points
114 views
0 votes
1 answer

Configuration metadata in Spring Framework

Configuration metadata can be provided to Spring container in ...READ MORE

answered Aug 2, 2018 in Java by code.reaper12
• 3,450 points
415 views
0 votes
1 answer

@Autowired annotation in Spring Framework

The @Autowired annotation provides more accurate control over where ...READ MORE

answered Aug 2, 2018 in Java by geek.erkami
• 2,320 points
71 views
0 votes
1 answer

Types of IOC containers in Spring Framework

There are basically two types of IOC ...READ MORE

answered Aug 27, 2018 in Java by misc.edu04
• 1,380 points
79 views
0 votes
1 answer

Spring configuration file

A Spring configuration file is an XML ...READ MORE

answered Aug 27, 2018 in Java by v.liyyah
• 1,290 points
16 views
0 votes
1 answer

Retrieve all the implementations of an interface in Java

Hi...I think you can achieve this by ...READ MORE

answered Jul 23, 2018 in Java by anto.trigg4
• 3,420 points
118 views
0 votes
1 answer

SuppressWarnings (“unchecked”) in Java

@SuppressWarnings("unchecked") is used when Java generics just don't ...READ MORE

answered Sep 4, 2018 in Java by anto.trigg4
• 3,420 points
39 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.