0% found this document useful (0 votes)
23 views

Spring Framework: Dependency Injection Ioc Container Bean Creation Spring Beans Autowiring Springmvc

The document discusses key concepts in Spring Framework including dependency injection, inversion of control (IOC) container, bean creation, autowiring, and Spring MVC. It explains that dependency injection allows Java components to be independent of each other and can be achieved without Spring through setter and constructor injection. The Spring Framework uses a factory pattern and IOC container to more easily implement dependency injection by managing the lifecycle and satisfying dependencies of beans.

Uploaded by

ajazahmed
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views

Spring Framework: Dependency Injection Ioc Container Bean Creation Spring Beans Autowiring Springmvc

The document discusses key concepts in Spring Framework including dependency injection, inversion of control (IOC) container, bean creation, autowiring, and Spring MVC. It explains that dependency injection allows Java components to be independent of each other and can be achieved without Spring through setter and constructor injection. The Spring Framework uses a factory pattern and IOC container to more easily implement dependency injection by managing the lifecycle and satisfying dependencies of beans.

Uploaded by

ajazahmed
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Spring Framework

Dependency Injection
IOC container
Bean Creation
Spring Beans
Autowiring
SpringMVC
Dependency Injection
Java components / classes should be as independent as
possible of other Java classes.

Dependency Injection is the way in which we make java


components/ classes independent of each other.

Dependency Injection can be achieved without spring


framework also.

Spring framework makes easier to achieve Dependency


Injection.
Types of Dependency Injections:

1.Setter Injection
2.Constructor Injection

Setter Injection and Constructor Injection:


A class A has a dependency to class B if class A uses
class B as a variable.
If class B is injected to class A

via a setter - this is then called setter injection


via a constructor then called constructor injection
Factory Pattern
Spring uses factory pattern for creation of spring beans

Object Object Factory

Configuration file
Application context and Web application context

Application Context is an interface, therefore it


cannot be instantiated.

To instantiate one of the (non-abstract) classes that


implement the application Context interface.

Web application context is also an interface and is


used in Spring MVC applications.

Beans, instantiated in Web application Context will


also be able to use Servlet Context.
Spring IOC container:

The Inversion of Control is the process by which


application defines the dependency and these
dependencies are then satisfied in runtime by the
Spring Framework.

The IOC container is the main component of the


Spring framework.

The core container of the Spring Framework provides


dependency injection and bean lifecycle
management.
Autowiring
Autowiring by name

Autowiring by type

You might also like