Setter Injection is a type of dependency injection (DI) in which the framework uses a setter method to inject dependent objects into the client. The container first calls the no argument constructor and later it calls the setters. Such setter-based injections can work even if dependencies are injected using the constructor.

Constructor injection uses a constructor for injecting dependencies on Spring-managed beans. The constructor DI is achieved when the container initiates a class constructor with arguments, each argument representing dependencies on other classes.

Suggest An Answer

No suggestions avaliable!