Home
About Us
Contact Us
Bookmark
Saved Bookmarks
Current Affairs
General Knowledge
Chemical Engineering
UPSEE
BSNL
ISRO
BITSAT
Amazon
ORACLE
Verbal Ability
→
Spring Interview Questions
→
Spring AOP, Spring JDBC, Spring Hibernate Interview Questions in Spring Interview Questions
→
Explain the difference between constructor and set...
1.
Explain the difference between constructor and setter injection?
Answer»
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. The creation of a 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.
Show Answer
Discussion
No Comment Found
Post Comment
Related InterviewSolutions
What are the limitations of autowiring?
What is autowiring and name the different modes of it?
What do you understand by Bean Wiring.
Explain Bean life cycle in Spring Bean Factory Container.
What are the bean scopes available in Spring?
How is the configuration meta data provided to the spring container?
What are Spring Beans?
Explain the difference between constructor and setter injection?
What do you understand by Dependency Injection?
What do you mean by IoC (Inversion of Control) Container?
Reply to Comment
×
Name
*
Email
*
Comment
*
Submit Reply
Your experience on this site will be improved by allowing cookies. Read
Cookie Policy
Reject
Allow cookies