Select Page

Dependency Injection Summary

Written by Buddhi

2018-08-05

Summary of dependency injection in Spring Boot.

  • All the necessary dependencies are handed over to the object by spring.
  • It frees the object from resolving the dependencies.
  • It greatly simplifies the code and improves code reusability.
  • It promotes programming to interfaces.
  • Conceals implementation details of dependencies.
  • It improves testability.
  • Dependencies easily stubbed out for unit testing.
  • Allows for centralized control over object lifecycle.

Ways to achieve dependency Injection.

  1. Using constructor
  2. Using setter method
  3. Using @Autowired annotation.

Related Articles

List users in windows

List users and groups in Windows Type Users in search box or enter lusrmgr.msc in Run dialog box Win+R -> lusrmgr.msc -> enter

Using scp to copy files

Copy file from local pc to remote server   scp <filename> <useronremotesystem>@<ipaddressofremotesystem>:<remotedirpath>/<remotefilename> scp mytext.txt user2@192.168.1.25:/home/user2/mytext.txt  Copy file from remote server to local pc…

Docker and Docker Compose

Docker Compose docker-compose.yml file contains the command to run, start, stop all the containers and services mentioned inside the file. up build or create or recreate container and start it docker-compose up build build the container but won’t start it…