Skip to content

aashutoshbane/Spring-Dependency-Injection

Repository files navigation

Basic Spring Dependency Injection (DI)

  1. Constructor Injection
  2. Setter Injection

Dependency Injection is a fundamental aspect of the Spring framework, through which the Spring container "injects" objects into other objects or "dependencies".

Simply put, this allows for loose coupling of components and moves the responsibility of managing components onto the container.

Download spring jar files

https://repo.spring.io/release/org/springframework/spring/

  1. Choose the latest stable release "*-dist.zip".
  2. Copy all the jar files under lib folder from the downloaded zip.
  3. Create a new folder name lib under your working directory.
  4. Paste those jar files under lib folder.
  5. Add classpath to your eclipse project.
  6. Right click on your "Project" >> "Properties" >> "Java Build Path" >> "Libraries" tab >> Click "Add JARs" >> "Select all the JAR files from you lib folder" >> "Apply and Close".
  7. Now there will be a "Referenced Libraries" folder which will have your all spring JAR files.
  8. Done

Run Project

Right click on your project >> Run As >> Java Application

About

Basic Spring Dependency Injections (Constructor & Setter)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages