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

Thread Communication in Java

Thread Communication in Java

Dependency Injection Summary 0 Comments Written by Buddhi2018-08-05Interthread communication in Java package org.example; public class ThreadCommunication { private static final int DATA_SIZE = 1000; public static void main(String[] args) { //common channel for…

Spring Annotations and Component Scanning

Spring Annotations and Component Scanning

Dependency Injection Summary 0 Comments Written by Buddhi2018-08-05Best practices for defining components and scanning them Annotate the class by including the exact place where to scan for components with @ComponentScan({“com.app.service”,”…

Various description of Big O – Time complexity algorithms

Various description of Big O – Time complexity algorithms

Dependency Injection Summary 0 Comments Written by Buddhi2018-08-05Understanding the time complexity of Big O and log. O(log N) means time goes up linearly while the n goes up exponentially. So if it takes 1 second to compute 10 elements, it will take 2 seconds to…