Skip to content

This Lab focused on dependency injection using the Spring Framework in Java :octocat:

Notifications You must be signed in to change notification settings

TmaneChouaib/dependency-injection-spring

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

This Lab focused on dependency injection using the Spring Framework in Java :octocat:

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages