filmov
tv
Spring Framework Tutorial || Dependency Injection using Setter Injection in Spring Framework || #04
Показать описание
In this video I have discussed how to inject values to Spring Bean from Spring Configuration File using Setter Injection.
What is Spring Framework
=========================
Spring is open source light weight framework for building Java applications easily and quickly. It can be considered as framework of framework because it supports various frameworks like Hibernate , Struts , JSF, EJB etc. This framework is modular consisting of 20 modules. Due to its modular nature we can work only with the modules required for our project and rest modules can be ignored.
This framework was developed by Rod Johnson in 2003 by using the design principle Dependency Injection(DI) and later on Spring Team added more features as separate modules. Current version of Spring is 5.2.8.
Inversion of Contol
===================
It is a design principle where the control flow of program is inverted. Here control refers to additional responsibility of class like control over the flow of application or control over the dependent object creation.It is used to achieve loose coupling between application classes which increases testability and maintainability of code.Ioc design principle can be implemented by different technique like event, delegates, DI, service locator.
Dependency Injection
=======================
It is a design pattern used to implement IoC. With DI we create the dependent object outside the class and provide the object to the class by using constructor injection , property injection , method injection.
IoC Container
==============
It is a framework used to implement the automatic DI.
Advantage of Spring Framework
==============================
1. Lightweight Spring allows us to develop applications with POJO and does not force the programmer to extend or implement any class or interface and so it is said to be non-invasive.
2. Loose Coupling Spring applications are loosely coupled due to DI/IOC
3. Testability Since Spring application is loosely coupled testing the application is very easy.
4. Modular
5. Predefined Templates Spring framework provides template for JDBC, Hibernate etc.
6. Integration with other Frameworks Spring support various frameworks like Struts , Hibernate etc.
7. MVC Framework
Spring Modules
=================
1. Test Support for testing with JUnit and TestNG
2. Core Container
==============
a. Core Provides key part of the framework which includes DI & IOC
b. Bean Responsible for creating & managing Spring Beans
c. Context Allow us to access any object defined in the setting.Key element is ApplicationContext interface.
d. SpEL Provides EL for manipulation objects at run time
3. Web
========
a. Web Provides functionalities creating web application , downloading files , REST API etc.
b. WebMVC Provides Spring MVC implementation for Web applications
c. Web Socket Provides communication between client and server by web socket
d. Web Portlet Provides MVC implementation in Portlet environment.
4. Data Access
===============
a. JDBC Provides abstract layer for JDBC which allows developer to avoid writing boilerplate code
b. ORM Provides integration with ORM frameworks like Hibernate
c. OXM Responsible for Java Object/XML mapping. Support for different OXM frameworks like JAXB , Castor etc.
d. JMS Responsible for creating and consuming messages
e. Transaction Supports transaction management for classes that implement special interfaces
5. Miscellaneous
================
a. AOP Supports implementation of Aspect oriented programming where we can use Advices , Pointcuts to decouple the code.
b. Aspects Provides integration with AspectJ( AOP Framework)
c. Instrumentation Provides class instrumentation support and class loader implementation which is used in Application Servers.
d. Messaging Provides STOMP(Simple (or Streaming) Text Oriented Message Protocol) support
#CodePulse #SpringFramework #SpringCore
What is Spring Framework
=========================
Spring is open source light weight framework for building Java applications easily and quickly. It can be considered as framework of framework because it supports various frameworks like Hibernate , Struts , JSF, EJB etc. This framework is modular consisting of 20 modules. Due to its modular nature we can work only with the modules required for our project and rest modules can be ignored.
This framework was developed by Rod Johnson in 2003 by using the design principle Dependency Injection(DI) and later on Spring Team added more features as separate modules. Current version of Spring is 5.2.8.
Inversion of Contol
===================
It is a design principle where the control flow of program is inverted. Here control refers to additional responsibility of class like control over the flow of application or control over the dependent object creation.It is used to achieve loose coupling between application classes which increases testability and maintainability of code.Ioc design principle can be implemented by different technique like event, delegates, DI, service locator.
Dependency Injection
=======================
It is a design pattern used to implement IoC. With DI we create the dependent object outside the class and provide the object to the class by using constructor injection , property injection , method injection.
IoC Container
==============
It is a framework used to implement the automatic DI.
Advantage of Spring Framework
==============================
1. Lightweight Spring allows us to develop applications with POJO and does not force the programmer to extend or implement any class or interface and so it is said to be non-invasive.
2. Loose Coupling Spring applications are loosely coupled due to DI/IOC
3. Testability Since Spring application is loosely coupled testing the application is very easy.
4. Modular
5. Predefined Templates Spring framework provides template for JDBC, Hibernate etc.
6. Integration with other Frameworks Spring support various frameworks like Struts , Hibernate etc.
7. MVC Framework
Spring Modules
=================
1. Test Support for testing with JUnit and TestNG
2. Core Container
==============
a. Core Provides key part of the framework which includes DI & IOC
b. Bean Responsible for creating & managing Spring Beans
c. Context Allow us to access any object defined in the setting.Key element is ApplicationContext interface.
d. SpEL Provides EL for manipulation objects at run time
3. Web
========
a. Web Provides functionalities creating web application , downloading files , REST API etc.
b. WebMVC Provides Spring MVC implementation for Web applications
c. Web Socket Provides communication between client and server by web socket
d. Web Portlet Provides MVC implementation in Portlet environment.
4. Data Access
===============
a. JDBC Provides abstract layer for JDBC which allows developer to avoid writing boilerplate code
b. ORM Provides integration with ORM frameworks like Hibernate
c. OXM Responsible for Java Object/XML mapping. Support for different OXM frameworks like JAXB , Castor etc.
d. JMS Responsible for creating and consuming messages
e. Transaction Supports transaction management for classes that implement special interfaces
5. Miscellaneous
================
a. AOP Supports implementation of Aspect oriented programming where we can use Advices , Pointcuts to decouple the code.
b. Aspects Provides integration with AspectJ( AOP Framework)
c. Instrumentation Provides class instrumentation support and class loader implementation which is used in Application Servers.
d. Messaging Provides STOMP(Simple (or Streaming) Text Oriented Message Protocol) support
#CodePulse #SpringFramework #SpringCore