- 🏋️♂️ 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.
- 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.
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
- For any inquires or feedback regarding this project, please contact me on: chouaib.tmane@hotmail.com.
End
Author: Tmane Chouaib