Table of Contents
Tutorial Content:Spring tutorial for beginners
- Introduction to spring framework
- Spring interview questions
- Dependency injection(ioc) in spring
- Spring XML based configuration example
- Spring java based configuaration
- Dependency injection via setter method in spring
- Dependency injection via constructor in spring
- Spring Bean scopes with examples
- Initializing collections in spring
- Beans Autowiring in spring
- Inheritance in Spring
- Spring ApplicationContext
- Spring lifetime callbacks
- BeanPostProcessors in Spring
- Annotation based Configuration in spring
- Spring AOP tutorial
i.e., Applying IoC, objects are given their dependencies at creation time by some external entity that coordinates each object in the system. That is, dependencies are injected into objects. So, IoC means an inversion of responsibility with regard to how an object obtains references to collaborating objects.

Example:
Normal way:
![]() |
Without DI |
![]() |
With DI |
Benifits of Dependency Injection in Spring:
- Ensures configuration and uses of services are separate.
- Can switch implementations by just changing configuration.
- Enhances Testability as mock dependencies can be injected.
- Dependencies can be easily identified.
- No need to read code to see what dependencies your code talks to.
Types of Dependency Injection:
-
Setter Injection:Setter-based DI is realized by calling setter methods on your beans after invoking a no-argument constructor or no-argument static factory method to instantiate your bean.
-
Constructor Injection:Constructor-based DI is realized by invoking a constructor with a number of arguments, each representing a collaborator.
- Inteface Injection: In interface-based dependency injection, we will have an interface and on implementing it we will get the instance injected.
We will see above injection type in further posts.
In next post we will see spring hello world program in spring.
very nice post!!
abc
bbc
fff
mamu
deg
aaa
it s simple to understand. i was checking thru various websites but cudnt understand them.. hav to learn springs in a day for simple projects… thanks a lot fr making a simple way for learning concepts..
Very nice.. Thanx a lot…
very nice post..its really help for beginners.
Good Explanation…
nie
gooooooooooooooooooooood
good