adspace


What is the difference between constructor injection and setter injection?

Answer Posted / Ankita Srivastava

"Constructor injection involves injecting dependencies through a project's constructor, ensuring that an object is properly initialized. Setter injection, on the other hand, involves setting properties of an object after its creation by using setter methods. Both techniques are used for dependency injection in Spring Framework but have different implications for object initialization and accessibility."n

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can you inject java collection in spring?

518


What is lazy class?

490


What is difference between @controller and @restcontroller in spring?

556