Skip to content

Latest commit

 

History

History
77 lines (61 loc) · 6.47 KB

README.md

File metadata and controls

77 lines (61 loc) · 6.47 KB

DI - Spring IoC Demo

🔎 Table of Contents :

📎 About :

  • 🏋️‍♂️ This lab, focuses on dependency injection (DI) using Spring Framework in Java. It builds upon the concepts explored in the first Lab, where the basics of dependency injection and inversion of control (IoC) were covered. To understand The fundamental concepts and features of dependency injection, please refer to the first Lab.

📎 Features :

  • SpringXMLPresentation : Demonstrates dependency injection using Spring XML configuration. It reads the bean configurations from the 'applicationContext.xml' file, instantiates the DAO and Business implementations defined in the XML, and injects the dependencies accordingly.
  • SpringAnnotationPresentation : Illustrates dependency injection using Spring annotations. It utilizes component scanning and annotation-based configuration to automatically detect and wire the dependencies.
  • Interface Abstraction : Continues to utilize the IDao and IBusiness interfaces for loose coupling and easy swapping of implementations, as established in the First Lab.
  • Multiple Implementations : Supports multiple implementations of IDao and IBusiness interfaces allowing flexibility in choosing the different implementations for retrieving data from various sources.
  • Externalized Configuration : Utilizes externalized configuration files applicationContex.xml and annotations to define the bean dependencies and wiring This enables easy modification and configuration without modifying the source code.

📎 Class Diagram : (DI/DIP) - Layer Structure :

📎 Project Structure:

dependency-injection-demo/
│
├── src/
│   ├── business/
│   │   ├── IBusiness.java
│   │   └── BusinessImpl.java
│   │
│   ├── dao/
│   │   ├── IDao.java
│   │   └── DaoImpl_A.java
│   │
│   ├── extension/
│   │   ├── DaoImpl_B.java
│   │   └── DaoImpl_C.java
│   │
│   ├── presentation/
│   │   ├── DynamicPresentation.java
│   │   └── SpringAnnotationPresentation.java
│   │   └── SpringXmlPresentation.java
│   │   └── StaticPresentation.java
│   │
│   └── Main.java
│
├── config.txt
└── README.md

📎 Contacts:

End


Author: Tmane Chouaib