SlideShare a Scribd company logo
By→ Anuj Kumar Singh
What is Spring ?
1. Spring Framework is a open source Java Platform that provides
comprehensive infrastructure support for developing robust Java
application very easily and rapidly.
2. Spring framework was developed by Rod Johnson and was first
released in 2003 in Spring Organization now Pivotal.
3. Earlier name of Spring Framework was Interface21 later changed to
Spring based on Spring season.
4. Spring Framework is replacement of EJB’s (Enterprise Java Beans)
because of heavy weight of EJB’s
Why Spring ?
1. Spring is the most popular application development framework for
enterprise Java. Millions of developers around the world use Spring
Framework to create high performing, easily testable, and reusable
code.
2. Spring is lightweight when it comes to size and transparency. The
basic version of Spring framework is around 2MB.
3. The core features of the Spring Framework can be used in
developing any Java application, but there are extensions for
building web applications on top of the Java EE platform.
4. Spring framework targets to make J2EE development easier to use
and promotes good programming practices by enabling a
POJO-based programming model.
Advantages of Spring
1. Lightweight - Spring framework is lightweight because of its POJO
implementation.The Spring framework doesn’t force any
programmer to inherit any class or implements any interface. That
is why it is said non-invasive, Enable you to write powerful, scalable
applications using POJO.
2. Easy to develop J2EE application - The Dependency Injection
feature of Spring Framework and it support to various frameworks
makes the easy development of JavaEE application.
3. Easy to test - The Dependency Injection makes easier to test the
application. The EJB or Struts application require server to run the
application but Spring framework doesn't require server.
1. Loose Coupling - The Spring applications are loosely coupled
because of dependency injection and handles injecting dependent
components without a component knowing where they came from
(IoC).
2. Powerful abstraction - It provides powerful abstraction to JavaEE
specifications such as JDBC.
3. Declarative support - It provides declarative support for caching,
validation, transactions and formatting.
4. Portable - can use server - side in web/ejb app, client-side in swing
app, business logic is completely portable.
5. Lifecycle - Responsible for managing all your application
components, particularly those in the middle tier container sees
components through well-defined lifecycle: init(), destroy()
Modules of the Spring Framework
1. Core - Inversion of Control (IoC) and Dependency Injection.
2. AOP - These modules support aspect oriented programming
implementation where you can use Advices, Pointcuts etc. to
decouple the code.
3. DAO - Data Access Object support, transaction management,
JDBC-abstraction
4. ORM - Object Relational Mapping data access, integration layers
for Hibernate
5. MVC - Model-View-Controller implementation for web applications
6. Expression Language - It is an extension to the EL defined in JSP. It
provides support to setting and getting property values, method
invocation, accessing collections and indexers, named variables.
IOC and Dependency Injection
1. Dependency Injection is the main functionality provided by Spring
IOC (Inversion of Control).
2. The Spring-Core module is responsible for injecting dependencies
through either Constructor or Setter methods in POJO class.
3. Dependency Injection in Spring also ensures loose-coupling
between the classes.
Need for Dependency Injection:
1. Spring IOC resolves dependencies with Dependency Injection,
which makes the code easier to test and reuse.
2. Loose coupling between classes can be possible by defining
interfaces for common functionality and the injector will instantiate
the objects of required implementation.
Example
Tightly Coupling - (without IOC)
class Employee{
Address address;
Employee()
{address=new Address(“xyz street”, ”Lucknow”, ”UP”);
}}
One class object is created in another class in tight coupling.Leads to
a.Stop server
b.Recomplie
c.Create jar and war file
d.Redeploy
e.Restart the server.
Loose Coupling
1. with IOC (Constructor Injection)
class Employee{
Address address;
Employee(Address address)
{this.address=address;} }
2. with IOC (Setter Injection)
class Employee{
Address address;
public void setAddress(Address address)
{this.address=address;} }
No need to stop the existing component, in real time it is better.
Spring Architecture (Very loosely coupled, components widely reusable)
and separately packaged.
1. Spring allows to decouple software layers by injecting a
component’s dependencies at runtime rather than having them
declared at compile time via importing and instantiating classes.
2. Spring provides integration for J2EE services such as EJB, JDBC,
JNDI, JMS, JTA. It also integrates several popular ORM toolkits
such as Hibernate and JDO and assorted other services as well.
3. One of the highly touted
4. Spring is built on the principle of unchecked exception handling.
This also reduces code dependencies between layers. Spring
provides a granular exception hierarchy for data access operations
and maps JDBC, EJB, and ORM exceptions to Spring exceptions
so that applications can get better information about the error
condition.
Flow Control in Spring
How to Start Using Spring
1. create the class
2. create the xml file to provide the values
3. create the test class
4. Load the spring jar files
5. Run the test class
1. CLASS FILE - POJO (PLAIN OLD JAVA OBJECT)
2. TEST FILE - DAO (DATA ACCESS OBJECT)
3. BEAN FILE - XML
4. Load the jar files required for spring framework
There are mainly three jar files required to run this application.
1. org.springframework.core-3.0.1.RELEASE-A
2. com.springsource.org.apache.commons.logging-1.1.1
3. org.springframework.beans-3.0.1.RELEASE-A
5. Run the TEST FILE
Containers in Spring
1. Core Container (slower)
a. It is called Lazy Container.
b. It create object on demand one by one.
c. It will create the object when the bean file is loaded.
ClassPathResource res=new ClassPathResource(“Spring.xml”);
XmlBeanFactory fact=new XmlBeanFactory(res);
fact.getBean(“abc”);
2. J2EE Container (faster)
a. It is called Eager Container.
b. It create all object at once.
c. It cerate the object as soon as object of ApplicationContext is made.
ApplicationContext con=new
ClassPathXmlApplicationContext(“Spring.xml”);
Bean File
• Typical java bean with a unique id
• In spring there are basically two types
1. Singleton
One instance of the bean created and referenced each time it
is requested
<bean class=“bean.Test” id=“t” scope=“singleton”>
One object for all caller.
2. Prototype (non-singleton)
<bean class=“bean.Test” id=“t” scope=“prototype”>
multiple object i.e. one one object for each caller.
Spring framework Introduction

More Related Content

What's hot

Java spring framework
Java spring frameworkJava spring framework
Java spring framework
Rajiv Gupta
 
Spring Framework
Spring Framework  Spring Framework
Spring Framework
tola99
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework
Serhat Can
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework
ASG
 
Spring introduction
Spring introductionSpring introduction
Spring introduction
Manav Prasad
 
Spring Boot
Spring BootSpring Boot
Spring Boot
Jaydeep Kale
 
Spring boot - an introduction
Spring boot - an introductionSpring boot - an introduction
Spring boot - an introduction
Jonathan Holloway
 
Spring Boot in Action
Spring Boot in Action Spring Boot in Action
Spring Boot in Action
Alex Movila
 
Java Spring Framework
Java Spring FrameworkJava Spring Framework
Java Spring Framework
Mehul Jariwala
 
Spring Security
Spring SecuritySpring Security
Spring Security
Knoldus Inc.
 
Spring ppt
Spring pptSpring ppt
Spring ppt
Mumbai Academisc
 
Spring boot
Spring bootSpring boot
Spring boot
Pradeep Shanmugam
 
Spring boot Introduction
Spring boot IntroductionSpring boot Introduction
Spring boot Introduction
Jeevesh Pandey
 
Spring Boot
Spring BootSpring Boot
Spring Boot
Jaran Flaath
 
Spring Framework - Core
Spring Framework - CoreSpring Framework - Core
Spring Framework - Core
Dzmitry Naskou
 
What Is Spring Framework In Java | Spring Framework Tutorial For Beginners Wi...
What Is Spring Framework In Java | Spring Framework Tutorial For Beginners Wi...What Is Spring Framework In Java | Spring Framework Tutorial For Beginners Wi...
What Is Spring Framework In Java | Spring Framework Tutorial For Beginners Wi...
Edureka!
 
Introduction to Spring Boot!
Introduction to Spring Boot!Introduction to Spring Boot!
Introduction to Spring Boot!Jakub Kubrynski
 
Introduction to Spring's Dependency Injection
Introduction to Spring's Dependency InjectionIntroduction to Spring's Dependency Injection
Introduction to Spring's Dependency Injection
Richard Paul
 

What's hot (20)

Java spring framework
Java spring frameworkJava spring framework
Java spring framework
 
Spring Framework
Spring Framework  Spring Framework
Spring Framework
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework
 
Spring introduction
Spring introductionSpring introduction
Spring introduction
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
Spring boot - an introduction
Spring boot - an introductionSpring boot - an introduction
Spring boot - an introduction
 
Spring Boot in Action
Spring Boot in Action Spring Boot in Action
Spring Boot in Action
 
Java Spring Framework
Java Spring FrameworkJava Spring Framework
Java Spring Framework
 
Spring Security
Spring SecuritySpring Security
Spring Security
 
Spring ppt
Spring pptSpring ppt
Spring ppt
 
Spring boot
Spring bootSpring boot
Spring boot
 
Spring boot Introduction
Spring boot IntroductionSpring boot Introduction
Spring boot Introduction
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
Spring Framework - Core
Spring Framework - CoreSpring Framework - Core
Spring Framework - Core
 
Spring notes
Spring notesSpring notes
Spring notes
 
What Is Spring Framework In Java | Spring Framework Tutorial For Beginners Wi...
What Is Spring Framework In Java | Spring Framework Tutorial For Beginners Wi...What Is Spring Framework In Java | Spring Framework Tutorial For Beginners Wi...
What Is Spring Framework In Java | Spring Framework Tutorial For Beginners Wi...
 
Introduction to Spring Boot!
Introduction to Spring Boot!Introduction to Spring Boot!
Introduction to Spring Boot!
 
Introduction to Spring's Dependency Injection
Introduction to Spring's Dependency InjectionIntroduction to Spring's Dependency Injection
Introduction to Spring's Dependency Injection
 
Spring framework core
Spring framework coreSpring framework core
Spring framework core
 

Similar to Spring framework Introduction

Spring framework Introduction
Spring framework  IntroductionSpring framework  Introduction
Spring framework Introduction
Anuj Singh Rajput
 
Spring framework-tutorial
Spring framework-tutorialSpring framework-tutorial
Spring framework-tutorial
vinayiqbusiness
 
Spring framework
Spring frameworkSpring framework
Spring frameworkKani Selvam
 
스프링 프레임워크
스프링 프레임워크스프링 프레임워크
스프링 프레임워크
Yoonki Chang
 
Spring framework
Spring frameworkSpring framework
Spring framework
vietduc17
 
Spring Framework Tutorial | VirtualNuggets
Spring Framework Tutorial | VirtualNuggetsSpring Framework Tutorial | VirtualNuggets
Spring Framework Tutorial | VirtualNuggets
Virtual Nuggets
 
Spring Basics
Spring BasicsSpring Basics
Java spring ppt
Java spring pptJava spring ppt
Java spring ppt
natashasweety7
 
Spring (1)
Spring (1)Spring (1)
Spring (1)
Aneega
 
spring framework ppt by Rohit malav
spring framework ppt by Rohit malavspring framework ppt by Rohit malav
spring framework ppt by Rohit malav
Rohit malav
 
Month 3 report
Month 3 reportMonth 3 report
Month 3 report
PRIYANKA FNU
 
Spring framework
Spring frameworkSpring framework
Spring framework
Sonal Poddar
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework
Dineesha Suraweera
 
Learn Spring Boot With Bisky - Intoduction
Learn Spring Boot With Bisky - IntoductionLearn Spring Boot With Bisky - Intoduction
Learn Spring Boot With Bisky - Intoduction
MarshallChabaga
 
Spring
SpringSpring
Spring
komalpreethi
 
How Spring Framework Really Works?
How Spring Framework Really Works?How Spring Framework Really Works?
How Spring Framework Really Works?
NexSoftsys
 
The Complete Spring Tutorial
The Complete Spring TutorialThe Complete Spring Tutorial
The Complete Spring Tutorialcribes
 
Spring Architecture | Advanced Java
Spring Architecture | Advanced JavaSpring Architecture | Advanced Java
Spring Architecture | Advanced Java
VISHAL DONGA
 

Similar to Spring framework Introduction (20)

Spring framework Introduction
Spring framework  IntroductionSpring framework  Introduction
Spring framework Introduction
 
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 framework
Spring frameworkSpring framework
Spring framework
 
Spring Framework Tutorial | VirtualNuggets
Spring Framework Tutorial | VirtualNuggetsSpring Framework Tutorial | VirtualNuggets
Spring Framework Tutorial | VirtualNuggets
 
Spring Basics
Spring BasicsSpring Basics
Spring Basics
 
Java spring ppt
Java spring pptJava spring ppt
Java spring ppt
 
Springs_Training
Springs_TrainingSprings_Training
Springs_Training
 
Spring (1)
Spring (1)Spring (1)
Spring (1)
 
spring framework ppt by Rohit malav
spring framework ppt by Rohit malavspring framework ppt by Rohit malav
spring framework ppt by Rohit malav
 
Month 3 report
Month 3 reportMonth 3 report
Month 3 report
 
Spring framework
Spring frameworkSpring framework
Spring framework
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework
 
Learn Spring Boot With Bisky - Intoduction
Learn Spring Boot With Bisky - IntoductionLearn Spring Boot With Bisky - Intoduction
Learn Spring Boot With Bisky - Intoduction
 
Spring
SpringSpring
Spring
 
How Spring Framework Really Works?
How Spring Framework Really Works?How Spring Framework Really Works?
How Spring Framework Really Works?
 
The Complete Spring Tutorial
The Complete Spring TutorialThe Complete Spring Tutorial
The Complete Spring Tutorial
 
Spring Architecture | Advanced Java
Spring Architecture | Advanced JavaSpring Architecture | Advanced Java
Spring Architecture | Advanced Java
 

More from Anuj Singh Rajput

Web technology
Web technologyWeb technology
Web technology
Anuj Singh Rajput
 
Java script
Java scriptJava script
Java script
Anuj Singh Rajput
 
Html (hypertext markup language)
Html (hypertext markup language)Html (hypertext markup language)
Html (hypertext markup language)
Anuj Singh Rajput
 
Css
CssCss
Bootstrap
BootstrapBootstrap
Jsp session 13
Jsp   session 13Jsp   session 13
Jsp session 13
Anuj Singh Rajput
 
Jsp session 12
Jsp   session 12Jsp   session 12
Jsp session 12
Anuj Singh Rajput
 
Jsp session 11
Jsp   session 11Jsp   session 11
Jsp session 11
Anuj Singh Rajput
 
Jsp session 10
Jsp   session 10Jsp   session 10
Jsp session 10
Anuj Singh Rajput
 
Jsp session 9
Jsp   session 9Jsp   session 9
Jsp session 9
Anuj Singh Rajput
 
Jsp session 8
Jsp   session 8Jsp   session 8
Jsp session 8
Anuj Singh Rajput
 
Jsp session 7
Jsp   session 7Jsp   session 7
Jsp session 7
Anuj Singh Rajput
 
Jsp session 6
Jsp   session 6Jsp   session 6
Jsp session 6
Anuj Singh Rajput
 
Jsp session 5
Jsp   session 5Jsp   session 5
Jsp session 5
Anuj Singh Rajput
 
Jsp session 4
Jsp   session 4Jsp   session 4
Jsp session 4
Anuj Singh Rajput
 
Jsp session 3
Jsp   session 3Jsp   session 3
Jsp session 3
Anuj Singh Rajput
 
Jsp session 2
Jsp   session 2Jsp   session 2
Jsp session 2
Anuj Singh Rajput
 
Jsp session 1
Jsp   session 1Jsp   session 1
Jsp session 1
Anuj Singh Rajput
 
Servlet session 14
Servlet   session 14Servlet   session 14
Servlet session 14
Anuj Singh Rajput
 
Servlet session 13
Servlet   session 13Servlet   session 13
Servlet session 13
Anuj Singh Rajput
 

More from Anuj Singh Rajput (20)

Web technology
Web technologyWeb technology
Web technology
 
Java script
Java scriptJava script
Java script
 
Html (hypertext markup language)
Html (hypertext markup language)Html (hypertext markup language)
Html (hypertext markup language)
 
Css
CssCss
Css
 
Bootstrap
BootstrapBootstrap
Bootstrap
 
Jsp session 13
Jsp   session 13Jsp   session 13
Jsp session 13
 
Jsp session 12
Jsp   session 12Jsp   session 12
Jsp session 12
 
Jsp session 11
Jsp   session 11Jsp   session 11
Jsp session 11
 
Jsp session 10
Jsp   session 10Jsp   session 10
Jsp session 10
 
Jsp session 9
Jsp   session 9Jsp   session 9
Jsp session 9
 
Jsp session 8
Jsp   session 8Jsp   session 8
Jsp session 8
 
Jsp session 7
Jsp   session 7Jsp   session 7
Jsp session 7
 
Jsp session 6
Jsp   session 6Jsp   session 6
Jsp session 6
 
Jsp session 5
Jsp   session 5Jsp   session 5
Jsp session 5
 
Jsp session 4
Jsp   session 4Jsp   session 4
Jsp session 4
 
Jsp session 3
Jsp   session 3Jsp   session 3
Jsp session 3
 
Jsp session 2
Jsp   session 2Jsp   session 2
Jsp session 2
 
Jsp session 1
Jsp   session 1Jsp   session 1
Jsp session 1
 
Servlet session 14
Servlet   session 14Servlet   session 14
Servlet session 14
 
Servlet session 13
Servlet   session 13Servlet   session 13
Servlet session 13
 

Recently uploaded

Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
DRUGS AND ITS classification slide share
DRUGS AND ITS classification slide shareDRUGS AND ITS classification slide share
DRUGS AND ITS classification slide share
taiba qazi
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
David Douglas School District
 
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
NelTorrente
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
Scholarhat
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
Celine George
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 
Digital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion DesignsDigital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion Designs
chanes7
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
TechSoup
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
thanhdowork
 
Landownership in the Philippines under the Americans-2-pptx.pptx
Landownership in the Philippines under the Americans-2-pptx.pptxLandownership in the Philippines under the Americans-2-pptx.pptx
Landownership in the Philippines under the Americans-2-pptx.pptx
JezreelCabil2
 
Aficamten in HCM (SEQUOIA HCM TRIAL 2024)
Aficamten in HCM (SEQUOIA HCM TRIAL 2024)Aficamten in HCM (SEQUOIA HCM TRIAL 2024)
Aficamten in HCM (SEQUOIA HCM TRIAL 2024)
Ashish Kohli
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
tarandeep35
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
Celine George
 
Delivering Micro-Credentials in Technical and Vocational Education and Training
Delivering Micro-Credentials in Technical and Vocational Education and TrainingDelivering Micro-Credentials in Technical and Vocational Education and Training
Delivering Micro-Credentials in Technical and Vocational Education and Training
AG2 Design
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
Dr. Shivangi Singh Parihar
 
Best Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDABest Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDA
deeptiverma2406
 

Recently uploaded (20)

Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
DRUGS AND ITS classification slide share
DRUGS AND ITS classification slide shareDRUGS AND ITS classification slide share
DRUGS AND ITS classification slide share
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
 
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 
Digital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion DesignsDigital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion Designs
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
 
Landownership in the Philippines under the Americans-2-pptx.pptx
Landownership in the Philippines under the Americans-2-pptx.pptxLandownership in the Philippines under the Americans-2-pptx.pptx
Landownership in the Philippines under the Americans-2-pptx.pptx
 
Aficamten in HCM (SEQUOIA HCM TRIAL 2024)
Aficamten in HCM (SEQUOIA HCM TRIAL 2024)Aficamten in HCM (SEQUOIA HCM TRIAL 2024)
Aficamten in HCM (SEQUOIA HCM TRIAL 2024)
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
 
Delivering Micro-Credentials in Technical and Vocational Education and Training
Delivering Micro-Credentials in Technical and Vocational Education and TrainingDelivering Micro-Credentials in Technical and Vocational Education and Training
Delivering Micro-Credentials in Technical and Vocational Education and Training
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
 
Best Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDABest Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDA
 

Spring framework Introduction

  • 2. What is Spring ? 1. Spring Framework is a open source Java Platform that provides comprehensive infrastructure support for developing robust Java application very easily and rapidly. 2. Spring framework was developed by Rod Johnson and was first released in 2003 in Spring Organization now Pivotal. 3. Earlier name of Spring Framework was Interface21 later changed to Spring based on Spring season. 4. Spring Framework is replacement of EJB’s (Enterprise Java Beans) because of heavy weight of EJB’s
  • 3. Why Spring ? 1. Spring is the most popular application development framework for enterprise Java. Millions of developers around the world use Spring Framework to create high performing, easily testable, and reusable code. 2. Spring is lightweight when it comes to size and transparency. The basic version of Spring framework is around 2MB. 3. The core features of the Spring Framework can be used in developing any Java application, but there are extensions for building web applications on top of the Java EE platform. 4. Spring framework targets to make J2EE development easier to use and promotes good programming practices by enabling a POJO-based programming model.
  • 4. Advantages of Spring 1. Lightweight - Spring framework is lightweight because of its POJO implementation.The Spring framework doesn’t force any programmer to inherit any class or implements any interface. That is why it is said non-invasive, Enable you to write powerful, scalable applications using POJO. 2. Easy to develop J2EE application - The Dependency Injection feature of Spring Framework and it support to various frameworks makes the easy development of JavaEE application. 3. Easy to test - The Dependency Injection makes easier to test the application. The EJB or Struts application require server to run the application but Spring framework doesn't require server.
  • 5. 1. Loose Coupling - The Spring applications are loosely coupled because of dependency injection and handles injecting dependent components without a component knowing where they came from (IoC). 2. Powerful abstraction - It provides powerful abstraction to JavaEE specifications such as JDBC. 3. Declarative support - It provides declarative support for caching, validation, transactions and formatting. 4. Portable - can use server - side in web/ejb app, client-side in swing app, business logic is completely portable. 5. Lifecycle - Responsible for managing all your application components, particularly those in the middle tier container sees components through well-defined lifecycle: init(), destroy()
  • 6. Modules of the Spring Framework 1. Core - Inversion of Control (IoC) and Dependency Injection. 2. AOP - These modules support aspect oriented programming implementation where you can use Advices, Pointcuts etc. to decouple the code. 3. DAO - Data Access Object support, transaction management, JDBC-abstraction 4. ORM - Object Relational Mapping data access, integration layers for Hibernate 5. MVC - Model-View-Controller implementation for web applications 6. Expression Language - It is an extension to the EL defined in JSP. It provides support to setting and getting property values, method invocation, accessing collections and indexers, named variables.
  • 7. IOC and Dependency Injection 1. Dependency Injection is the main functionality provided by Spring IOC (Inversion of Control). 2. The Spring-Core module is responsible for injecting dependencies through either Constructor or Setter methods in POJO class. 3. Dependency Injection in Spring also ensures loose-coupling between the classes. Need for Dependency Injection: 1. Spring IOC resolves dependencies with Dependency Injection, which makes the code easier to test and reuse. 2. Loose coupling between classes can be possible by defining interfaces for common functionality and the injector will instantiate the objects of required implementation.
  • 8. Example Tightly Coupling - (without IOC) class Employee{ Address address; Employee() {address=new Address(“xyz street”, ”Lucknow”, ”UP”); }} One class object is created in another class in tight coupling.Leads to a.Stop server b.Recomplie c.Create jar and war file d.Redeploy e.Restart the server.
  • 9. Loose Coupling 1. with IOC (Constructor Injection) class Employee{ Address address; Employee(Address address) {this.address=address;} } 2. with IOC (Setter Injection) class Employee{ Address address; public void setAddress(Address address) {this.address=address;} } No need to stop the existing component, in real time it is better.
  • 10. Spring Architecture (Very loosely coupled, components widely reusable) and separately packaged.
  • 11. 1. Spring allows to decouple software layers by injecting a component’s dependencies at runtime rather than having them declared at compile time via importing and instantiating classes. 2. Spring provides integration for J2EE services such as EJB, JDBC, JNDI, JMS, JTA. It also integrates several popular ORM toolkits such as Hibernate and JDO and assorted other services as well. 3. One of the highly touted 4. Spring is built on the principle of unchecked exception handling. This also reduces code dependencies between layers. Spring provides a granular exception hierarchy for data access operations and maps JDBC, EJB, and ORM exceptions to Spring exceptions so that applications can get better information about the error condition.
  • 12. Flow Control in Spring
  • 13. How to Start Using Spring 1. create the class 2. create the xml file to provide the values 3. create the test class 4. Load the spring jar files 5. Run the test class
  • 14. 1. CLASS FILE - POJO (PLAIN OLD JAVA OBJECT)
  • 15. 2. TEST FILE - DAO (DATA ACCESS OBJECT)
  • 16. 3. BEAN FILE - XML
  • 17. 4. Load the jar files required for spring framework There are mainly three jar files required to run this application. 1. org.springframework.core-3.0.1.RELEASE-A 2. com.springsource.org.apache.commons.logging-1.1.1 3. org.springframework.beans-3.0.1.RELEASE-A 5. Run the TEST FILE
  • 18. Containers in Spring 1. Core Container (slower) a. It is called Lazy Container. b. It create object on demand one by one. c. It will create the object when the bean file is loaded. ClassPathResource res=new ClassPathResource(“Spring.xml”); XmlBeanFactory fact=new XmlBeanFactory(res); fact.getBean(“abc”); 2. J2EE Container (faster) a. It is called Eager Container. b. It create all object at once. c. It cerate the object as soon as object of ApplicationContext is made. ApplicationContext con=new ClassPathXmlApplicationContext(“Spring.xml”);
  • 19. Bean File • Typical java bean with a unique id • In spring there are basically two types 1. Singleton One instance of the bean created and referenced each time it is requested <bean class=“bean.Test” id=“t” scope=“singleton”> One object for all caller. 2. Prototype (non-singleton) <bean class=“bean.Test” id=“t” scope=“prototype”> multiple object i.e. one one object for each caller.