Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

What is Dependency Injection in Spring Boot | Edureka

64 views

Published on

YouTube Link: https://youtu.be/O9mqe53syGc
** Microservices Architecture Training: https://www.edureka.co/microservices-... **
This Edureka tutorial on "What is Dependency Injection" will give you an introduction to dependency injection and also show a practical implementation of dependency injection with Spring Boot.
In this PPT, you will learn the following:
What is Dependency Injection?
Inversion of Control
Types of Dependency Injection
Benefits of Dependency Injection
Implement Dependency Injection using Spring Boot

Follow us to never miss an update in the future.
YouTube: https://www.youtube.com/user/edurekaIN
Instagram: https://www.instagram.com/edureka_learning/
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka
Castbox: https://castbox.fm/networks/505?country=in

Published in: Technology
  • Be the first to comment

  • Be the first to like this

What is Dependency Injection in Spring Boot | Edureka

  1. 1. What is Dependency Injection? Inversion of Control Types of Dependency Injection Benefits of Dependency Injection Implement Dependency Injection Using Spring Boot www.edureka.co
  2. 2. www.edureka.co
  3. 3. Class ClassA uses methods of B Class A is Dependent on B www.edureka.co
  4. 4. Class ClassBefore A uses methods of B Class A needs to create an instance of class B www.edureka.co
  5. 5. The process of creating an object for some other class and let the class directly using the dependency is called dependency injection. What is Dependency Injection(DI)? Class DI I need two objects www.edureka.co
  6. 6. The process of creating an object for some other class and let the class directly using the dependency is called dependency injection. What is Dependency Injection(DI)? Class DI Create Objects A objectA = new A() B objectB = new B() www.edureka.co
  7. 7. The process of creating an object for some other class and let the class directly using the dependency is called dependency injection. What is Dependency Injection(DI)? Class DI Returns objects to the class www.edureka.co
  8. 8. Dependency Injection uses three types of classes. The injector class creates an object of the service class. Then, the injector class injects the object to a client object. What is Dependency Injection(DI)? Client Class Injector Class Service Class www.edureka.co
  9. 9. www.edureka.co
  10. 10. Concept Behind Dependency Injection A class should not configure its dependencies statically but should be configured by some other class from outside. A class should concentrate on fulfilling its responsibilities like the flow of an application, and not on creating objects www.edureka.co
  11. 11. www.edureka.co
  12. 12. Dependencies are provided through a class constructor Injector method injects the dependency to the setter method exposed by the client. Injector uses Interface to provide the dependency to the client class. Constructor Setter Interface www.edureka.co
  13. 13. www.edureka.co
  14. 14. Email Service Class Objects 1. To email address 2. From email address 3. Subject 4. Body www.edureka.co
  15. 15. Email Service Class Recreate the Class www.edureka.co
  16. 16. Using Dependency Injection Change Objects at run time www.edureka.co
  17. 17. Reduction of Boiler plate code Unit Testing is made much easier Application can be easily extended Enables an easy way to interconnect the components 01 02 03 04 www.edureka.co
  18. 18. www.edureka.co
  19. 19. Copyright � 2017, edureka and/or its affiliates. All rights reserved. www.edureka.co
  20. 20. www.edureka.co

×