SlideShare a Scribd company logo
1 of 20
Introduction to
Spring Framework
Framework
 What is a Framework?
 Frameworks are large prewritten code to which you add your
own code to solve a problem in a specific domain.
 You make use of a framework by calling its methods,
inheritance and supplying “call-backs” listeners.
Example - Java’s Swing and AWT classes. Those have a huge amount of code
to manage the user interface and there is inversion of control.
Spring Framework
 What is a Spring Framework?
 Spring is an open source framework created to address the
complexity of enterprise application development.
 Creates high performing, easily testable, reusable code and
handles the infrastructure so you can focus on application.
 One of the chief advantages of the Spring framework is its
layered architecture, which allows you to be selective about
which of its components you use while also providing a
cohesive framework for J2EE application development.
Features Of Spring Framework
Spring is a Framework of Frameworks
• Lightweight
• Layered Architecture
• Predefined Templates
• Fast Development
• MVC Framework
• Inversion Of Control (IOC)
• Aspect Oriented Programming (AOP)
• Data Access Framework
• JDBC Abstraction Layer
• Logging
Overview of the Spring Framework
Spring Framework Architecture
 The Spring framework is a layered architecture which
consists of several modules.
 All modules are built on the top of its core container.
 It's modular architecture enables integration with other
frameworks without much difficulties.
 Consists of around 20 modules which are generalized into
Core Container, Data Access/ Integration, Web, AOP (Aspect
Oriented Programming), Instrumentation, and Test. All the
modules have their own functionalities that are utilized to
build an application.
Spring Framework Modules
Spring Framework Modules
 Core Container
1. Spring Core: This module is the core of the Spring Framework. It
provides implementation for features like IoC (Inversion of Control)
and Dependency Injection with singleton design pattern.
2. Spring Bean: This module provides implementation for the factory
design pattern through BeanFactory.
3. Spring Context: This module is built on the solid base provided by
the Core and the Beans modules and is a medium to access any object
defined and configured.
4. Spring Expression Languages (SpEL): This module is an
extension to expression language supported by Java server pages. It
provides a powerful expression language for querying and manipulating
an object graph, at runtime.
Spring Framework Modules
 AOP Module
• Spring AOP module provides interceptors to intercept an
application, for example, when a method is executed, you
can add extra functionality before or after the method
execution.
• Spring AOP's approach to AOP differs from that of most other
AOP frameworks. The aim is to provide a close integration
between AOP implementation and Spring IoC, not to provide
the most complete AOP implementation.
Spring Framework Modules
 Spring Data Access/ Integration
i. JDBC: This module provides JDBC abstraction layer which eliminates the need
of repetitive and unnecessary exception handling overhead.
ii. ORM: ORM stands for Object Relational Mapping. This module provides
consistency/portability to our code regardless of data access technologies
based on object oriented mapping concept.
iii. OXM: OXM stands for Object XML Mappers. It is used to convert the objects
into XML format and vice versa. The Spring OXM provides an uniform API to
access any of these OXM frameworks.
iv. JMS: JMS stands for Java Messaging Service. This module contains features for
producing and consuming messages among various clients.
v. Transaction: This module supports programmatic and declarative transaction
management for classes that implement special interfaces and for all your
POJOs. All the enterprise level transaction implementation concepts can be
implemented in Spring by using this module.
Spring Framework Modules
 Web Module
• Web: This module using servlet listeners and a web-oriented application
context, provides basic web-oriented integration features and the initialization
of the IoC container.
• Web-Servlet: This module contains Model-View-Controller (MVC) based
implementation for web applications. It provides all other features of MVC,
including UI tags and data validations.
• Web-Socket: This module provides support for WebSocket based and two-
way communication between the client and the server in web applications.
• Web-Portlet: This module is also known as Spring-MVC-Portlet module. It
provides the support for Spring based Portlets and provides MVC implementation
to be used in a portlet environment.
Spring Framework Modules
 Test Module
 This module supports the testing of Spring components with
JUnit or TestNG. It provides consistent loading of
Spring ApplicationContexts and caching of those contexts.
Spring Framework Advantages
 Templates : Provides predefined templates for JDBC,
Hibernate, JPA etc., thus reducing your effort of writing too
much code.
 Loose Coupling : Because of dependency injection
feature, your code becomes loosely coupled.
 Lightweight : Works on POJOs (Plain Old Java Object) which
makes your application lightweight.
 Declarative : Programming through aspects, common
conventions and provides declarative support for
transactions, validation, caching and formatting.
Spring Framework Advantages
 Fast Development : Using Spring Framework, the
development of Java Enterprise Edition (JEE) applications
became faster.
 Strong Abstraction : It provides strong abstraction to Java
Enterprise Edition (JEE) specifications.
 Maintainability : Reusable Code and Open Source.
Eliminating boilerplate code with aspects and template.
 Testing : Testing a Spring Application is so easy for DI and no
server needs to run the application.
Key Component - IoC
Inversion Of Control
Concept of application development.
“Don't call us, we'll call you.”
Dependency Injection is form of IoC.
Key Component - DI
Dependency Injection
 The technology that actually defines spring (Heart of Spring).
 When applying DI, the objects are given their
dependencies at creation time by some external entity
that coordinates each object in the system. In other
words, dependencies are injected into objects.
 “Don't call around for your dependencies, we'll give them
to you when we need you”.
 Exist in two form:
1. Constructor Injection
2. Setter Inject
Key Component - DI
Dependency Injection
 Dependency Injection helps us to keep our classes as
independent as possible.
Increase reuse by applying low coupling.
Easy Testing.
More Understandable.
Key Component - DI
Dependency Injection
An injection is the passing of dependency (a service) to a
dependent object (a client).
Passing the service to the client, rather than allowing a client to
build or find the service, is the fundamental requirement of the
pattern.
“Dependency Injection is a pattern where the container passes
objects by name to other objects, via either constructors, properties
or factory methods.”
Key Component – DI & IoC
Relationship between DI and Inversion of Control
In software engineering, inversion of Control (IoC)
describes a design in which custom-written portions of a
computer program receive the flow of control from a
generic reusable library.
The Inversion of Control (Ioc) is a general concepts, and it can be expressed in many
different ways and dependency Injection is merely one concrete example of
Inversion of Control.
Key Component – IoC
Ioc Container
 The spring container (IoC Container) is at the core of the Spring
Framework.
 The Container will create the objects, wire them together, configure
them, and manage their complete lifecycle from creation till
destruction.

More Related Content

What's hot

What's hot (20)

Java Spring Framework
Java Spring FrameworkJava Spring Framework
Java Spring Framework
 
Spring Boot Tutorial
Spring Boot TutorialSpring Boot Tutorial
Spring Boot Tutorial
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework
 
Spring boot Introduction
Spring boot IntroductionSpring boot Introduction
Spring boot Introduction
 
Spring Framework
Spring FrameworkSpring Framework
Spring Framework
 
Spring boot introduction
Spring boot introductionSpring boot introduction
Spring boot introduction
 
Introduction to Spring Framework and Spring IoC
Introduction to Spring Framework and Spring IoCIntroduction to Spring Framework and Spring IoC
Introduction to Spring Framework and Spring IoC
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework
 
Spring boot
Spring bootSpring boot
Spring boot
 
Spring Framework - Core
Spring Framework - CoreSpring Framework - Core
Spring Framework - Core
 
Introduction to Spring Boot
Introduction to Spring BootIntroduction to Spring Boot
Introduction to Spring Boot
 
Java Persistence API (JPA) Step By Step
Java Persistence API (JPA) Step By StepJava Persistence API (JPA) Step By Step
Java Persistence API (JPA) Step By Step
 
Spring MVC Framework
Spring MVC FrameworkSpring MVC Framework
Spring MVC Framework
 
Spring framework in depth
Spring framework in depthSpring framework in depth
Spring framework in depth
 
Java spring ppt
Java spring pptJava spring ppt
Java spring ppt
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
Spring Data JPA
Spring Data JPASpring Data JPA
Spring Data JPA
 
Spring mvc
Spring mvcSpring mvc
Spring mvc
 
Spring ppt
Spring pptSpring ppt
Spring ppt
 
Spring boot
Spring bootSpring boot
Spring boot
 

Similar to Introduction to Spring Framework

Introduction to Spring sec1.pptx
Introduction to Spring sec1.pptxIntroduction to Spring sec1.pptx
Introduction to Spring sec1.pptxNourhanTarek23
 
Spring Framework Tutorial | VirtualNuggets
Spring Framework Tutorial | VirtualNuggetsSpring Framework Tutorial | VirtualNuggets
Spring Framework Tutorial | VirtualNuggetsVirtual Nuggets
 
Spring Architecture | Advanced Java
Spring Architecture | Advanced JavaSpring Architecture | Advanced Java
Spring Architecture | Advanced JavaVISHAL DONGA
 
Introduction to j2 ee frameworks
Introduction to j2 ee frameworksIntroduction to j2 ee frameworks
Introduction to j2 ee frameworksMukesh Kumar
 
Spring framework-tutorial
Spring framework-tutorialSpring framework-tutorial
Spring framework-tutorialvinayiqbusiness
 
Spring framework
Spring frameworkSpring framework
Spring frameworkKani Selvam
 
Spring (1)
Spring (1)Spring (1)
Spring (1)Aneega
 
The Power of Enterprise Java Frameworks
The Power of Enterprise Java FrameworksThe Power of Enterprise Java Frameworks
The Power of Enterprise Java FrameworksClarence Ho
 
Spring core module
Spring core moduleSpring core module
Spring core moduleRaj Tomar
 
How Spring Framework Really Works?
How Spring Framework Really Works?How Spring Framework Really Works?
How Spring Framework Really Works?NexSoftsys
 
Session 43 - Spring - Part 1 - IoC DI Beans
Session 43 - Spring - Part 1 - IoC DI BeansSession 43 - Spring - Part 1 - IoC DI Beans
Session 43 - Spring - Part 1 - IoC DI BeansPawanMM
 
spring framework ppt by Rohit malav
spring framework ppt by Rohit malavspring framework ppt by Rohit malav
spring framework ppt by Rohit malavRohit malav
 
Framework adoption for java enterprise application development
Framework adoption for java enterprise application developmentFramework adoption for java enterprise application development
Framework adoption for java enterprise application developmentClarence Ho
 
TheSpringFramework
TheSpringFrameworkTheSpringFramework
TheSpringFrameworkShankar Nair
 
Oleksandr Valetskyy - Become a .NET dependency injection ninja with Ninject
Oleksandr Valetskyy - Become a .NET dependency injection ninja with NinjectOleksandr Valetskyy - Become a .NET dependency injection ninja with Ninject
Oleksandr Valetskyy - Become a .NET dependency injection ninja with NinjectOleksandr Valetskyy
 

Similar to Introduction to Spring Framework (20)

Introduction to Spring sec1.pptx
Introduction to Spring sec1.pptxIntroduction to Spring sec1.pptx
Introduction to Spring sec1.pptx
 
Spring Framework Tutorial | VirtualNuggets
Spring Framework Tutorial | VirtualNuggetsSpring Framework Tutorial | VirtualNuggets
Spring Framework Tutorial | VirtualNuggets
 
Spring Architecture | Advanced Java
Spring Architecture | Advanced JavaSpring Architecture | Advanced Java
Spring Architecture | Advanced Java
 
Introduction to j2 ee frameworks
Introduction to j2 ee frameworksIntroduction to j2 ee frameworks
Introduction to j2 ee frameworks
 
Spring framework-tutorial
Spring framework-tutorialSpring framework-tutorial
Spring framework-tutorial
 
Spring framework
Spring frameworkSpring framework
Spring framework
 
Spring framework
Spring frameworkSpring framework
Spring framework
 
Spring (1)
Spring (1)Spring (1)
Spring (1)
 
The Power of Enterprise Java Frameworks
The Power of Enterprise Java FrameworksThe Power of Enterprise Java Frameworks
The Power of Enterprise Java Frameworks
 
Spring mvc
Spring mvcSpring mvc
Spring mvc
 
Spring core module
Spring core moduleSpring core module
Spring core module
 
How Spring Framework Really Works?
How Spring Framework Really Works?How Spring Framework Really Works?
How Spring Framework Really Works?
 
Session 43 - Spring - Part 1 - IoC DI Beans
Session 43 - Spring - Part 1 - IoC DI BeansSession 43 - Spring - Part 1 - IoC DI Beans
Session 43 - Spring - Part 1 - IoC DI Beans
 
Spring notes
Spring notesSpring notes
Spring notes
 
Spring 2
Spring 2Spring 2
Spring 2
 
spring framework ppt by Rohit malav
spring framework ppt by Rohit malavspring framework ppt by Rohit malav
spring framework ppt by Rohit malav
 
Framework adoption for java enterprise application development
Framework adoption for java enterprise application developmentFramework adoption for java enterprise application development
Framework adoption for java enterprise application development
 
Spring Framework Rohit
Spring Framework RohitSpring Framework Rohit
Spring Framework Rohit
 
TheSpringFramework
TheSpringFrameworkTheSpringFramework
TheSpringFramework
 
Oleksandr Valetskyy - Become a .NET dependency injection ninja with Ninject
Oleksandr Valetskyy - Become a .NET dependency injection ninja with NinjectOleksandr Valetskyy - Become a .NET dependency injection ninja with Ninject
Oleksandr Valetskyy - Become a .NET dependency injection ninja with Ninject
 

More from ASG

Angular jS Introduction by Google
Angular jS Introduction by GoogleAngular jS Introduction by Google
Angular jS Introduction by GoogleASG
 
Dependency Injection in Spring
Dependency Injection in SpringDependency Injection in Spring
Dependency Injection in SpringASG
 
1. Spring intro IoC
1. Spring intro IoC1. Spring intro IoC
1. Spring intro IoCASG
 
JSP MCQ Question with Answer
JSP MCQ Question with AnswerJSP MCQ Question with Answer
JSP MCQ Question with AnswerASG
 
Rajshahi college (Golam Hossen)
Rajshahi college (Golam Hossen)Rajshahi college (Golam Hossen)
Rajshahi college (Golam Hossen)ASG
 
Call center technology(She Power Project)
Call center technology(She Power Project)Call center technology(She Power Project)
Call center technology(She Power Project)ASG
 
20th clubs joint quiz competition
20th clubs joint quiz competition20th clubs joint quiz competition
20th clubs joint quiz competitionASG
 

More from ASG (7)

Angular jS Introduction by Google
Angular jS Introduction by GoogleAngular jS Introduction by Google
Angular jS Introduction by Google
 
Dependency Injection in Spring
Dependency Injection in SpringDependency Injection in Spring
Dependency Injection in Spring
 
1. Spring intro IoC
1. Spring intro IoC1. Spring intro IoC
1. Spring intro IoC
 
JSP MCQ Question with Answer
JSP MCQ Question with AnswerJSP MCQ Question with Answer
JSP MCQ Question with Answer
 
Rajshahi college (Golam Hossen)
Rajshahi college (Golam Hossen)Rajshahi college (Golam Hossen)
Rajshahi college (Golam Hossen)
 
Call center technology(She Power Project)
Call center technology(She Power Project)Call center technology(She Power Project)
Call center technology(She Power Project)
 
20th clubs joint quiz competition
20th clubs joint quiz competition20th clubs joint quiz competition
20th clubs joint quiz competition
 

Recently uploaded

Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfngoud9212
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfjimielynbastida
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 

Recently uploaded (20)

Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdf
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdf
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 

Introduction to Spring Framework

  • 2. Framework  What is a Framework?  Frameworks are large prewritten code to which you add your own code to solve a problem in a specific domain.  You make use of a framework by calling its methods, inheritance and supplying “call-backs” listeners. Example - Java’s Swing and AWT classes. Those have a huge amount of code to manage the user interface and there is inversion of control.
  • 3. Spring Framework  What is a Spring Framework?  Spring is an open source framework created to address the complexity of enterprise application development.  Creates high performing, easily testable, reusable code and handles the infrastructure so you can focus on application.  One of the chief advantages of the Spring framework is its layered architecture, which allows you to be selective about which of its components you use while also providing a cohesive framework for J2EE application development.
  • 4. Features Of Spring Framework Spring is a Framework of Frameworks • Lightweight • Layered Architecture • Predefined Templates • Fast Development • MVC Framework • Inversion Of Control (IOC) • Aspect Oriented Programming (AOP) • Data Access Framework • JDBC Abstraction Layer • Logging
  • 5. Overview of the Spring Framework
  • 6. Spring Framework Architecture  The Spring framework is a layered architecture which consists of several modules.  All modules are built on the top of its core container.  It's modular architecture enables integration with other frameworks without much difficulties.  Consists of around 20 modules which are generalized into Core Container, Data Access/ Integration, Web, AOP (Aspect Oriented Programming), Instrumentation, and Test. All the modules have their own functionalities that are utilized to build an application.
  • 8. Spring Framework Modules  Core Container 1. Spring Core: This module is the core of the Spring Framework. It provides implementation for features like IoC (Inversion of Control) and Dependency Injection with singleton design pattern. 2. Spring Bean: This module provides implementation for the factory design pattern through BeanFactory. 3. Spring Context: This module is built on the solid base provided by the Core and the Beans modules and is a medium to access any object defined and configured. 4. Spring Expression Languages (SpEL): This module is an extension to expression language supported by Java server pages. It provides a powerful expression language for querying and manipulating an object graph, at runtime.
  • 9. Spring Framework Modules  AOP Module • Spring AOP module provides interceptors to intercept an application, for example, when a method is executed, you can add extra functionality before or after the method execution. • Spring AOP's approach to AOP differs from that of most other AOP frameworks. The aim is to provide a close integration between AOP implementation and Spring IoC, not to provide the most complete AOP implementation.
  • 10. Spring Framework Modules  Spring Data Access/ Integration i. JDBC: This module provides JDBC abstraction layer which eliminates the need of repetitive and unnecessary exception handling overhead. ii. ORM: ORM stands for Object Relational Mapping. This module provides consistency/portability to our code regardless of data access technologies based on object oriented mapping concept. iii. OXM: OXM stands for Object XML Mappers. It is used to convert the objects into XML format and vice versa. The Spring OXM provides an uniform API to access any of these OXM frameworks. iv. JMS: JMS stands for Java Messaging Service. This module contains features for producing and consuming messages among various clients. v. Transaction: This module supports programmatic and declarative transaction management for classes that implement special interfaces and for all your POJOs. All the enterprise level transaction implementation concepts can be implemented in Spring by using this module.
  • 11. Spring Framework Modules  Web Module • Web: This module using servlet listeners and a web-oriented application context, provides basic web-oriented integration features and the initialization of the IoC container. • Web-Servlet: This module contains Model-View-Controller (MVC) based implementation for web applications. It provides all other features of MVC, including UI tags and data validations. • Web-Socket: This module provides support for WebSocket based and two- way communication between the client and the server in web applications. • Web-Portlet: This module is also known as Spring-MVC-Portlet module. It provides the support for Spring based Portlets and provides MVC implementation to be used in a portlet environment.
  • 12. Spring Framework Modules  Test Module  This module supports the testing of Spring components with JUnit or TestNG. It provides consistent loading of Spring ApplicationContexts and caching of those contexts.
  • 13. Spring Framework Advantages  Templates : Provides predefined templates for JDBC, Hibernate, JPA etc., thus reducing your effort of writing too much code.  Loose Coupling : Because of dependency injection feature, your code becomes loosely coupled.  Lightweight : Works on POJOs (Plain Old Java Object) which makes your application lightweight.  Declarative : Programming through aspects, common conventions and provides declarative support for transactions, validation, caching and formatting.
  • 14. Spring Framework Advantages  Fast Development : Using Spring Framework, the development of Java Enterprise Edition (JEE) applications became faster.  Strong Abstraction : It provides strong abstraction to Java Enterprise Edition (JEE) specifications.  Maintainability : Reusable Code and Open Source. Eliminating boilerplate code with aspects and template.  Testing : Testing a Spring Application is so easy for DI and no server needs to run the application.
  • 15. Key Component - IoC Inversion Of Control Concept of application development. “Don't call us, we'll call you.” Dependency Injection is form of IoC.
  • 16. Key Component - DI Dependency Injection  The technology that actually defines spring (Heart of Spring).  When applying DI, the objects are given their dependencies at creation time by some external entity that coordinates each object in the system. In other words, dependencies are injected into objects.  “Don't call around for your dependencies, we'll give them to you when we need you”.  Exist in two form: 1. Constructor Injection 2. Setter Inject
  • 17. Key Component - DI Dependency Injection  Dependency Injection helps us to keep our classes as independent as possible. Increase reuse by applying low coupling. Easy Testing. More Understandable.
  • 18. Key Component - DI Dependency Injection An injection is the passing of dependency (a service) to a dependent object (a client). Passing the service to the client, rather than allowing a client to build or find the service, is the fundamental requirement of the pattern. “Dependency Injection is a pattern where the container passes objects by name to other objects, via either constructors, properties or factory methods.”
  • 19. Key Component – DI & IoC Relationship between DI and Inversion of Control In software engineering, inversion of Control (IoC) describes a design in which custom-written portions of a computer program receive the flow of control from a generic reusable library. The Inversion of Control (Ioc) is a general concepts, and it can be expressed in many different ways and dependency Injection is merely one concrete example of Inversion of Control.
  • 20. Key Component – IoC Ioc Container  The spring container (IoC Container) is at the core of the Spring Framework.  The Container will create the objects, wire them together, configure them, and manage their complete lifecycle from creation till destruction.