SlideShare ist ein Scribd-Unternehmen logo
1 von 39
SESSION – 1 & 2
By→ Anuj Kumar Singh
1. A framework, or software framework, is a platform for developing
software applications. It provides a foundation on which software
developers can build programs for a specific purpose.
2. A need of framework is a re-usable design platform for software
systems, which provides support for code libraries.
3. There are framework for Java, PHP, Ruby and many others.
4. All software frameworks are built with the idea of re-usability of the
code and provide tools that help the programmers develop and
mount together the different components of the software project.
What is a Framework?
These are the frames for constructing any building or house, for constructing
any building or house a frame is made first and then only the work based on
that frame is started, so this is what a framework is.
Example: 1
Suppose you have to make a tea on daily basis with several ingredients
like sugar, tea leaves , other spices , etc. In doing so on daily basis most
of the time you will find it is really difficult to put all ingredients in right
ratio all time you can forget sometimes, you have to open several boxes
one by one, one morning you come up with idea of mixing all ingredients
in one jar in one ratio, such that every spoon will serve the right ratio mix
to the tea. ( Off course milk and water remain aside :) )
Example: 2
This jar is your framework. When we want to do lots of things on regular
basis it just consumes time and a framework will not only save time it
will also provide right components in your applications fast and easy.
Popular Frameworks
CSS Bootstrap for front-end, Java Spring and PHP Laravel for back-end
Rod Johnson Ben Alex Thomas Risberg
Rod Johnson  Roderick "Rod" Johnson is an Australian computer specialist who created the
Spring Framework.
Ben Alex  Ben Alex develop and sends ACEGI Security code to Rod Johnson.
Thomas Risberg  Thomas Risberg is responsible for enhancements to the JDBC framework
portion.
Spring Framework  Developers
What is Spring Framework ?
1. Spring framework was developed by Rod Johnson and was first
released in 2003 in Spring Organization now Pivotal.
2. Spring Framework is replacement / alternative of EJB’s (Enterprise
Java Beans) because of heavy weight of EJB’s
3. Earlier name of Spring Framework was Interface21 later changed to
Spring based on Spring season.
4. Spring Framework is a open source Java Platform that provides
support for developing robust (Strong Memory Management and No
Pointers) Java application very easily and rapidly.
EJB is a specification, while Spring is an implementation. Spring itself was
developed as an alternative to EJB 2.0 primarily. There was EJB 3.0
which was developed to rectify the drawbacks in EJB 2.0. So if we
primarily compare EJB 3.0 with Spring on various parameters, it would be
as follows.
EJB’s Spring
The Applications developed under EJB
framework were heavy-weight because it uses
the libraries of the Application server + JDK
(Java Development Kit). EJB container is a part
of application server like JBoss which is heavy-
weight.
Spring is Light-weight because it uses only
it’s Jar file and JDK. It’s is not dependent on
application server that’s makes it much
lighter as compared to the EJB framework.
The Applications developed under EJB were
tightly-coupled i.e. if the other class object is
created in the dependent class then there exist
a Tight-coupling. Any changes in the class
object leads to the change in the Dependent
class.
Spring is loosely-coupled because if we
want any changes in the object of class then
we just need to configure the spring
configuration xml file (Spring manages
objects). We need not to make any changes
in the Dependent Class.
Why Spring Framework not EJB’s
Point of Comparison EJB’s Spring
Transaction Management Only JTA (Java Transaction API)
is supported.
Spring supports a wider
range, including JTA, JDBC,
Hibernate.
Persistence In EJB it is tightly integrated with
JPA (Java Persistence API)
Spring supports a wider range
that includes JPA, Hibernate,
JDBC
State Management Stateful Session Beans in EJB Spring it is indirectly
dependent on container
session management.
AOP EJB provide limited support Spring is more robust support
via AspectJ.
Security EJB has support security through
JAAS (Java Authentication and
Authorization Service)
Spring can go beyond JAAS,
through ACEGI (security 2.0)
Why Spring Framework?
1. Spring is the most popular application development framework for
enterprise. 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. Spring framework is the 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.
Versions of Spring Framework
Version Year Features
0.9 2002
1.0 2003 AOP , Application context concept, DAO support, JDBC
abstraction, Hibernate support, etc
2.0 2006 IoC container, Easier XML configuration, Easier AOP XML
configuration, Tag library for Spring MVC, etc
3.0 2009 Spring Expression Language, IoC enhancements,
Object to XML mapping, @MVC additions, etc
4.0 2013 Core Container Improvements, General Web
Improvements, WebSocket and STOMP Messaging
Testing Improvements, etc
5.0 2017 JDK baseline update, Core container updates. Functional
programming with Kotlin. Testing improvements.
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.
2. Spring provides integration for J2EE services such as EJB, JDBC.
It also integrates several popular ORM toolkits such as Hibernate
and JDO and assorted other services as well.
3. 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.
Core Container
1. The Core module provides the fundamental parts of the framework,
including the IoC and Dependency Injection features.
2. The Bean module provides BeanFactory, which is a sophisticated
implementation of the factory pattern.
3. The Context module builds on the solid base provided by the Core
and Beans modules and it is a medium to access any objects
defined and configured. The ApplicationContext interface is the
focal point of the Context module.
4. The SpEL module provides a powerful expression language for
querying and manipulating an object graph at runtime.
Data Access/Integration
1. The JDBC module provides a JDBC-abstraction layer that removes
the need for tedious JDBC related coding.
2. The ORM module provides integration layers for popular object-
relational mapping APIs, including JDO, Hibernate.
3. The OXM module provides an abstraction layer that supports
Object/XML mapping implementations for XMLBeans.
4. The Java Messaging Service JMS module contains features for
producing and consuming messages.
5. The Transaction module supports programmatic and declarative
transaction management for classes that implement special
interfaces and for all your POJOs.
Web
1. The Web module provides basic web-oriented integration features
such as multipart file-upload functionality and the initialization of the
IoC container using servlet listeners and a web-oriented application
context.
2. The Web-MVC module contains Spring's Model-View-Controller
(MVC) implementation for web applications.
3. The Web-Socket module provides support for WebSocket-based,
two-way communication between the client and the server in web
applications.
4. The Web-Portlet module provides the MVC implementation to be
used in a portlet environment and mirrors the functionality of Web-
Servlet module.
Miscellaneous
1. The AOP module provides an aspect-oriented programming
implementation allowing you to define method-interceptors and
pointcuts to cleanly decouple code.
2. The Aspects module provides integration with AspectJ, which is
again a powerful and mature AOP framework.
3. The Instrumentation module provides class instrumentation support
and class loader implementations to be used in certain application
servers.
4. The Messaging module provides support for STOMP as the
WebSocket sub-protocol to use in applications.
5. The Test module supports the testing of Spring components with
frameworks.
What is MVC(Model View Controller)
1. It follow the software Architectural pattern.
2. One of the most frequently used pattern.
3. Separate application functionality.
Model: (All Business Logic ) Pogo, Business Object, DAO classes
1. Data related logic
2. Interaction with database (INSERT,DELETE,UPDATE,SELECT)
3. Communication with Controller.
4. Can sometimes update the View
View: (Presentation View)  jsp, html, css
1. What the end user see.
2. Usually consist of HTML/CSS
3. Communicate with Controller.
4. Template Engine for variables
Controller: (request , response) Servlet
1. Receives request from View (url form)
2. Process the request.
3. Gets data from Model.
4. Response with data to the View.
Flow Control in Spring MVC
1. We have Controller which handle the request coming from client, but
the controller don’t get request directly, first the request is passed
(filtered) from the Dispatcher-Servlet.
2. The Dispatcher-Servlet is also known as Front-Controller provided
by Spring Framework and it is present inside the web.xml file.
3. The Dispatcher-Servlet or Front-Controller get to know about what
client has requested for, with the help of Configuration File
(configSpring.xml).
4. The Configuration File has all the mapping information for Controller
through Front-Controller.
5. And based on that mapping the response is generated by the
Controller and transferred to the Client.
Advantages of Spring MVC
1. Separate roles - The Spring MVC separates each role, where the
model object, controller, command object, view resolver,
DispatcherServlet, validator, etc. can be fulfilled by a specialized
object.
2. Light-weight - It uses light-weight servlet container to develop and
deploy your application.
3. Powerful Configuration - It provides a robust configuration for both
framework and application classes that includes easy referencing
across contexts, such as from web controllers to business objects and
validators.
4. Rapid development - The Spring MVC facilitates fast and parallel
development.
5. Reusable business code - Instead of creating new objects, it allows
us to use the existing business objects.
6. Easy to test - In Spring, generally we create JavaBeans classes
that enable you to inject test data using the setter methods.
7. Flexible Mapping - It provides the specific annotations that easily
redirect the page.
IDE’S (Integrated Development Environment’s) Available
1. Eclipse
Step 1: Click on File
Step 2: Select New
Step 3: Click on Other…
1. Eclipse
2. NetBeans
3. IntelliJ IDEA
etc
Project Setup in Eclipse and NetBeans
Step 4: Click on Maven Project
Step 5: Click on Next
Step 6: Browse and Set the default location for saving files
Step 7: Click on Next
Step 8: Select the webapp Group Id and Artifact Id
Step 9: Click on Next
Step 10: Give Artifact Name
Step 11: Click on Finish
2. NetBeans
Step 1: Click on New Project
Step 2: Select Java Web
Step 3: Select Web Application
Step 4: Click on Next
Step 5: Give Project Name
Step 6: Click on Next
Step 7: Select the Server
Step 8: Click on Next
Step 9: Select the Spring Web MVC
Step 10: Click on Finish
Example
1. POJO (PLAIN OLD JAVA OBJECT)
2. Test Class
3. XML Bean File
Spring framework  Introduction

Weitere ähnliche Inhalte

Was ist angesagt?

Spring Framework
Spring FrameworkSpring Framework
Spring Frameworknomykk
 
Spring Framework
Spring Framework  Spring Framework
Spring Framework tola99
 
Core java kvr - satya
Core  java kvr - satyaCore  java kvr - satya
Core java kvr - satyaSatya Johnny
 
Introduction to Ibatis by Rohit
Introduction to Ibatis by RohitIntroduction to Ibatis by Rohit
Introduction to Ibatis by RohitRohit Prabhakar
 
Hibernate Interview Questions
Hibernate Interview QuestionsHibernate Interview Questions
Hibernate Interview QuestionsSyed Shahul
 
Spring framework-tutorial
Spring framework-tutorialSpring framework-tutorial
Spring framework-tutorialvinayiqbusiness
 
Hibernate complete notes_by_sekhar_sir_javabynatara_j
Hibernate complete notes_by_sekhar_sir_javabynatara_jHibernate complete notes_by_sekhar_sir_javabynatara_j
Hibernate complete notes_by_sekhar_sir_javabynatara_jSatya Johnny
 
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 IoCFunnelll
 
The Complete Spring Tutorial
The Complete Spring TutorialThe Complete Spring Tutorial
The Complete Spring Tutorialcribes
 
Spring hibernate tutorial
Spring hibernate tutorialSpring hibernate tutorial
Spring hibernate tutorialRohit Jagtap
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring FrameworkRaveendra R
 

Was ist angesagt? (20)

Spring Framework
Spring FrameworkSpring Framework
Spring Framework
 
Spring Framework
Spring Framework  Spring Framework
Spring Framework
 
Spring Framework Rohit
Spring Framework RohitSpring Framework Rohit
Spring Framework Rohit
 
Core java kvr - satya
Core  java kvr - satyaCore  java kvr - satya
Core java kvr - satya
 
Introduction to Ibatis by Rohit
Introduction to Ibatis by RohitIntroduction to Ibatis by Rohit
Introduction to Ibatis by Rohit
 
Java Spring Framework
Java Spring FrameworkJava Spring Framework
Java Spring Framework
 
Hibernate Interview Questions
Hibernate Interview QuestionsHibernate Interview Questions
Hibernate Interview Questions
 
Spring framework-tutorial
Spring framework-tutorialSpring framework-tutorial
Spring framework-tutorial
 
Hibernate complete notes_by_sekhar_sir_javabynatara_j
Hibernate complete notes_by_sekhar_sir_javabynatara_jHibernate complete notes_by_sekhar_sir_javabynatara_j
Hibernate complete notes_by_sekhar_sir_javabynatara_j
 
Hibernate notes
Hibernate notesHibernate notes
Hibernate notes
 
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
 
J2EE Introduction
J2EE IntroductionJ2EE Introduction
J2EE Introduction
 
J2ee seminar
J2ee seminarJ2ee seminar
J2ee seminar
 
Spring ppt
Spring pptSpring ppt
Spring ppt
 
Spring framework
Spring frameworkSpring framework
Spring framework
 
The Complete Spring Tutorial
The Complete Spring TutorialThe Complete Spring Tutorial
The Complete Spring Tutorial
 
Spring hibernate tutorial
Spring hibernate tutorialSpring hibernate tutorial
Spring hibernate tutorial
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework
 
Java J2EE
Java J2EEJava J2EE
Java J2EE
 
Spring User Guide
Spring User GuideSpring User Guide
Spring User Guide
 

Ähnlich wie Spring framework Introduction

Spring Framework Tutorial | VirtualNuggets
Spring Framework Tutorial | VirtualNuggetsSpring Framework Tutorial | VirtualNuggets
Spring Framework Tutorial | VirtualNuggetsVirtual Nuggets
 
Spring (1)
Spring (1)Spring (1)
Spring (1)Aneega
 
Spring presentecion isil
Spring presentecion isilSpring presentecion isil
Spring presentecion isilWilly Aguirre
 
Spring presentecion isil
Spring presentecion isilSpring presentecion isil
Spring presentecion isilWilly Aguirre
 
Spring framework
Spring frameworkSpring framework
Spring frameworkKani Selvam
 
Introduction to j2 ee frameworks
Introduction to j2 ee frameworksIntroduction to j2 ee frameworks
Introduction to j2 ee frameworksMukesh Kumar
 
Comparison of spring and other frameworks.!
Comparison of spring and other frameworks.!Comparison of spring and other frameworks.!
Comparison of spring and other frameworks.!Sibu Stephen
 
Spring Architecture | Advanced Java
Spring Architecture | Advanced JavaSpring Architecture | Advanced Java
Spring Architecture | Advanced JavaVISHAL DONGA
 
Introduction Java Web Framework and Web Server.
Introduction Java Web Framework and Web Server.Introduction Java Web Framework and Web Server.
Introduction Java Web Framework and Web Server.suranisaunak
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring FrameworkDineesha Suraweera
 
Spring data jpa are used to develop spring applications
Spring data jpa are used to develop spring applicationsSpring data jpa are used to develop spring applications
Spring data jpa are used to develop spring applicationsmichaelaaron25322
 
Spring Basics
Spring BasicsSpring Basics
Spring BasicsEmprovise
 
Spring MVC framework
Spring MVC frameworkSpring MVC framework
Spring MVC frameworkMohit Gupta
 
How Spring Framework Really Works?
How Spring Framework Really Works?How Spring Framework Really Works?
How Spring Framework Really Works?NexSoftsys
 

Ähnlich wie Spring framework Introduction (20)

Spring Framework Tutorial | VirtualNuggets
Spring Framework Tutorial | VirtualNuggetsSpring Framework Tutorial | VirtualNuggets
Spring Framework Tutorial | VirtualNuggets
 
Spring (1)
Spring (1)Spring (1)
Spring (1)
 
Spring presentecion isil
Spring presentecion isilSpring presentecion isil
Spring presentecion isil
 
Spring presentecion isil
Spring presentecion isilSpring presentecion isil
Spring presentecion isil
 
Spring framework
Spring frameworkSpring framework
Spring framework
 
Introduction to j2 ee frameworks
Introduction to j2 ee frameworksIntroduction to j2 ee frameworks
Introduction to j2 ee frameworks
 
Spring 2
Spring 2Spring 2
Spring 2
 
Comparison of spring and other frameworks.!
Comparison of spring and other frameworks.!Comparison of spring and other frameworks.!
Comparison of spring and other frameworks.!
 
Spring Architecture | Advanced Java
Spring Architecture | Advanced JavaSpring Architecture | Advanced Java
Spring Architecture | Advanced Java
 
Java spring ppt
Java spring pptJava spring ppt
Java spring ppt
 
Spring
SpringSpring
Spring
 
Introduction Java Web Framework and Web Server.
Introduction Java Web Framework and Web Server.Introduction Java Web Framework and Web Server.
Introduction Java Web Framework and Web Server.
 
Springs_Training
Springs_TrainingSprings_Training
Springs_Training
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework
 
Ejb notes
Ejb notesEjb notes
Ejb notes
 
Spring data jpa are used to develop spring applications
Spring data jpa are used to develop spring applicationsSpring data jpa are used to develop spring applications
Spring data jpa are used to develop spring applications
 
Spring Basics
Spring BasicsSpring Basics
Spring Basics
 
Spring MVC framework
Spring MVC frameworkSpring MVC framework
Spring MVC framework
 
Month 3 report
Month 3 reportMonth 3 report
Month 3 report
 
How Spring Framework Really Works?
How Spring Framework Really Works?How Spring Framework Really Works?
How Spring Framework Really Works?
 

Mehr von 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
 

Kürzlich hochgeladen

Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...RKavithamani
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 

Kürzlich hochgeladen (20)

Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 

Spring framework Introduction

  • 1. SESSION – 1 & 2 By→ Anuj Kumar Singh
  • 2. 1. A framework, or software framework, is a platform for developing software applications. It provides a foundation on which software developers can build programs for a specific purpose. 2. A need of framework is a re-usable design platform for software systems, which provides support for code libraries. 3. There are framework for Java, PHP, Ruby and many others. 4. All software frameworks are built with the idea of re-usability of the code and provide tools that help the programmers develop and mount together the different components of the software project. What is a Framework?
  • 3. These are the frames for constructing any building or house, for constructing any building or house a frame is made first and then only the work based on that frame is started, so this is what a framework is. Example: 1
  • 4. Suppose you have to make a tea on daily basis with several ingredients like sugar, tea leaves , other spices , etc. In doing so on daily basis most of the time you will find it is really difficult to put all ingredients in right ratio all time you can forget sometimes, you have to open several boxes one by one, one morning you come up with idea of mixing all ingredients in one jar in one ratio, such that every spoon will serve the right ratio mix to the tea. ( Off course milk and water remain aside :) ) Example: 2
  • 5. This jar is your framework. When we want to do lots of things on regular basis it just consumes time and a framework will not only save time it will also provide right components in your applications fast and easy. Popular Frameworks CSS Bootstrap for front-end, Java Spring and PHP Laravel for back-end
  • 6. Rod Johnson Ben Alex Thomas Risberg Rod Johnson  Roderick "Rod" Johnson is an Australian computer specialist who created the Spring Framework. Ben Alex  Ben Alex develop and sends ACEGI Security code to Rod Johnson. Thomas Risberg  Thomas Risberg is responsible for enhancements to the JDBC framework portion. Spring Framework  Developers
  • 7. What is Spring Framework ? 1. Spring framework was developed by Rod Johnson and was first released in 2003 in Spring Organization now Pivotal. 2. Spring Framework is replacement / alternative of EJB’s (Enterprise Java Beans) because of heavy weight of EJB’s 3. Earlier name of Spring Framework was Interface21 later changed to Spring based on Spring season. 4. Spring Framework is a open source Java Platform that provides support for developing robust (Strong Memory Management and No Pointers) Java application very easily and rapidly.
  • 8. EJB is a specification, while Spring is an implementation. Spring itself was developed as an alternative to EJB 2.0 primarily. There was EJB 3.0 which was developed to rectify the drawbacks in EJB 2.0. So if we primarily compare EJB 3.0 with Spring on various parameters, it would be as follows.
  • 9. EJB’s Spring The Applications developed under EJB framework were heavy-weight because it uses the libraries of the Application server + JDK (Java Development Kit). EJB container is a part of application server like JBoss which is heavy- weight. Spring is Light-weight because it uses only it’s Jar file and JDK. It’s is not dependent on application server that’s makes it much lighter as compared to the EJB framework. The Applications developed under EJB were tightly-coupled i.e. if the other class object is created in the dependent class then there exist a Tight-coupling. Any changes in the class object leads to the change in the Dependent class. Spring is loosely-coupled because if we want any changes in the object of class then we just need to configure the spring configuration xml file (Spring manages objects). We need not to make any changes in the Dependent Class. Why Spring Framework not EJB’s
  • 10. Point of Comparison EJB’s Spring Transaction Management Only JTA (Java Transaction API) is supported. Spring supports a wider range, including JTA, JDBC, Hibernate. Persistence In EJB it is tightly integrated with JPA (Java Persistence API) Spring supports a wider range that includes JPA, Hibernate, JDBC State Management Stateful Session Beans in EJB Spring it is indirectly dependent on container session management. AOP EJB provide limited support Spring is more robust support via AspectJ. Security EJB has support security through JAAS (Java Authentication and Authorization Service) Spring can go beyond JAAS, through ACEGI (security 2.0)
  • 11. Why Spring Framework? 1. Spring is the most popular application development framework for enterprise. 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. Spring framework is the 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.
  • 12. Versions of Spring Framework Version Year Features 0.9 2002 1.0 2003 AOP , Application context concept, DAO support, JDBC abstraction, Hibernate support, etc 2.0 2006 IoC container, Easier XML configuration, Easier AOP XML configuration, Tag library for Spring MVC, etc 3.0 2009 Spring Expression Language, IoC enhancements, Object to XML mapping, @MVC additions, etc 4.0 2013 Core Container Improvements, General Web Improvements, WebSocket and STOMP Messaging Testing Improvements, etc 5.0 2017 JDK baseline update, Core container updates. Functional programming with Kotlin. Testing improvements.
  • 13. Spring Architecture (Very loosely coupled, components widely reusable) and separately packaged.
  • 14. 1. Spring allows to decouple software layers by injecting a component’s dependencies at runtime rather than having them declared at compile time. 2. Spring provides integration for J2EE services such as EJB, JDBC. It also integrates several popular ORM toolkits such as Hibernate and JDO and assorted other services as well. 3. 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.
  • 15. Core Container 1. The Core module provides the fundamental parts of the framework, including the IoC and Dependency Injection features. 2. The Bean module provides BeanFactory, which is a sophisticated implementation of the factory pattern. 3. The Context module builds on the solid base provided by the Core and Beans modules and it is a medium to access any objects defined and configured. The ApplicationContext interface is the focal point of the Context module. 4. The SpEL module provides a powerful expression language for querying and manipulating an object graph at runtime.
  • 16. Data Access/Integration 1. The JDBC module provides a JDBC-abstraction layer that removes the need for tedious JDBC related coding. 2. The ORM module provides integration layers for popular object- relational mapping APIs, including JDO, Hibernate. 3. The OXM module provides an abstraction layer that supports Object/XML mapping implementations for XMLBeans. 4. The Java Messaging Service JMS module contains features for producing and consuming messages. 5. The Transaction module supports programmatic and declarative transaction management for classes that implement special interfaces and for all your POJOs.
  • 17. Web 1. The Web module provides basic web-oriented integration features such as multipart file-upload functionality and the initialization of the IoC container using servlet listeners and a web-oriented application context. 2. The Web-MVC module contains Spring's Model-View-Controller (MVC) implementation for web applications. 3. The Web-Socket module provides support for WebSocket-based, two-way communication between the client and the server in web applications. 4. The Web-Portlet module provides the MVC implementation to be used in a portlet environment and mirrors the functionality of Web- Servlet module.
  • 18. Miscellaneous 1. The AOP module provides an aspect-oriented programming implementation allowing you to define method-interceptors and pointcuts to cleanly decouple code. 2. The Aspects module provides integration with AspectJ, which is again a powerful and mature AOP framework. 3. The Instrumentation module provides class instrumentation support and class loader implementations to be used in certain application servers. 4. The Messaging module provides support for STOMP as the WebSocket sub-protocol to use in applications. 5. The Test module supports the testing of Spring components with frameworks.
  • 19. What is MVC(Model View Controller) 1. It follow the software Architectural pattern. 2. One of the most frequently used pattern. 3. Separate application functionality.
  • 20. Model: (All Business Logic ) Pogo, Business Object, DAO classes 1. Data related logic 2. Interaction with database (INSERT,DELETE,UPDATE,SELECT) 3. Communication with Controller. 4. Can sometimes update the View View: (Presentation View)  jsp, html, css 1. What the end user see. 2. Usually consist of HTML/CSS 3. Communicate with Controller. 4. Template Engine for variables Controller: (request , response) Servlet 1. Receives request from View (url form) 2. Process the request. 3. Gets data from Model. 4. Response with data to the View.
  • 21. Flow Control in Spring MVC
  • 22. 1. We have Controller which handle the request coming from client, but the controller don’t get request directly, first the request is passed (filtered) from the Dispatcher-Servlet. 2. The Dispatcher-Servlet is also known as Front-Controller provided by Spring Framework and it is present inside the web.xml file. 3. The Dispatcher-Servlet or Front-Controller get to know about what client has requested for, with the help of Configuration File (configSpring.xml). 4. The Configuration File has all the mapping information for Controller through Front-Controller. 5. And based on that mapping the response is generated by the Controller and transferred to the Client.
  • 23.
  • 24. Advantages of Spring MVC 1. Separate roles - The Spring MVC separates each role, where the model object, controller, command object, view resolver, DispatcherServlet, validator, etc. can be fulfilled by a specialized object. 2. Light-weight - It uses light-weight servlet container to develop and deploy your application. 3. Powerful Configuration - It provides a robust configuration for both framework and application classes that includes easy referencing across contexts, such as from web controllers to business objects and validators. 4. Rapid development - The Spring MVC facilitates fast and parallel development.
  • 25. 5. Reusable business code - Instead of creating new objects, it allows us to use the existing business objects. 6. Easy to test - In Spring, generally we create JavaBeans classes that enable you to inject test data using the setter methods. 7. Flexible Mapping - It provides the specific annotations that easily redirect the page.
  • 26. IDE’S (Integrated Development Environment’s) Available 1. Eclipse Step 1: Click on File Step 2: Select New Step 3: Click on Other… 1. Eclipse 2. NetBeans 3. IntelliJ IDEA etc Project Setup in Eclipse and NetBeans
  • 27.
  • 28. Step 4: Click on Maven Project Step 5: Click on Next
  • 29. Step 6: Browse and Set the default location for saving files Step 7: Click on Next
  • 30. Step 8: Select the webapp Group Id and Artifact Id Step 9: Click on Next
  • 31. Step 10: Give Artifact Name Step 11: Click on Finish
  • 32. 2. NetBeans Step 1: Click on New Project Step 2: Select Java Web Step 3: Select Web Application Step 4: Click on Next
  • 33. Step 5: Give Project Name Step 6: Click on Next
  • 34. Step 7: Select the Server Step 8: Click on Next
  • 35. Step 9: Select the Spring Web MVC Step 10: Click on Finish
  • 36. Example 1. POJO (PLAIN OLD JAVA OBJECT)
  • 38. 3. XML Bean File