`
https://www.edureka.co/spring-frameworkEDUREKA SPRING FRAMEWORK CERTIFICATION TRAINING
What is Hadoop?
`
https://www.edureka.co/spring-frameworkEDUREKA SPRING FRAMEWORK CERTIFICATION TRAINING
Agenda For Today
Why Java Frameworks ?
Java Frameworks
Spring Framework
Why Spring Framework?
Spring Modules
IoC Container
Bean
Dependency Injection
`
https://www.edureka.co/spring-frameworkEDUREKA SPRING FRAMEWORK CERTIFICATION TRAINING
Why Java Frameworks ?
`
https://www.edureka.co/spring-frameworkEDUREKA SPRING FRAMEWORK CERTIFICATION TRAINING
Why Java Frameworks ?
'look-up' problem
Heavy weighted
components
Problems with J2EE Standards
Too complex
Java Frameworks
`
https://www.edureka.co/spring-frameworkEDUREKA SPRING FRAMEWORK CERTIFICATION TRAINING
What Are Java Frameworks?
Large bodies of
predefined code
Added to our
own code
Solves a problem
in a specific
domain
Frameworks are large bodies (usually many classes) of predefined code to
which we can add to our own code to solve a problem in a specific domain.
`
https://www.edureka.co/spring-frameworkEDUREKA SPRING FRAMEWORK CERTIFICATION TRAINING
Advantages of Java Framework
S E C U R I T Y
E F F I C I E N C Y
E X P E N S E
S U P P O R T
`
https://www.edureka.co/spring-frameworkEDUREKA SPRING FRAMEWORK CERTIFICATION TRAINING
Disadvantages of Java Framework
R E S T R I C T I O N
C O D E I S P U B L I C
C U S T O M B U I L T F E AT U R E S
`
https://www.edureka.co/spring-frameworkEDUREKA SPRING FRAMEWORK CERTIFICATION TRAINING
Different Java Frameworks
`
https://www.edureka.co/spring-frameworkEDUREKA SPRING FRAMEWORK CERTIFICATION TRAINING
Different Java Frameworks
`
https://www.edureka.co/spring-frameworkEDUREKA SPRING FRAMEWORK CERTIFICATION TRAINING
Harry
Max
Scott
Riya
Henry Alice
Web Development Team of XYZ company with
a group of six members, headed by Harry.
Spring
Harry got a call from the management team for
one urgent requirement.
`
https://www.edureka.co/spring-frameworkEDUREKA SPRING FRAMEWORK CERTIFICATION TRAINING
Harry
Team...We got one
request from the client to
develop an application but
the challenge is that we have
got very little time frame to
complete this Project
Spring
`
https://www.edureka.co/spring-frameworkEDUREKA SPRING FRAMEWORK CERTIFICATION TRAINING
Harry
If we go by the general way
it’ll take a lot of time as well as
unnecessary coding
Spring
`
https://www.edureka.co/spring-frameworkEDUREKA SPRING FRAMEWORK CERTIFICATION TRAINING
Harry
We need something that’s fast,
flexible and efficient.
Spring
`
https://www.edureka.co/spring-frameworkEDUREKA SPRING FRAMEWORK CERTIFICATION TRAINING
In that case we can use
any Framework !
Riya
Spring
Or we can use Hibernate
We can go for Struts
MaxAlice
`
https://www.edureka.co/spring-frameworkEDUREKA SPRING FRAMEWORK CERTIFICATION TRAINING
We can use Spring
framework. It provides
more flexibility as Spring MVC
is entirely based on interfaces
unlike Struts or hibernate so we
can easily make required changes
in implementation without
affecting the client side.
Riya
Spring
Riya, can you tell us more about
Spring Framework. How will it
solve our problem??
Scott
`
https://www.edureka.co/spring-frameworkEDUREKA SPRING FRAMEWORK CERTIFICATION TRAINING
It will increase the efficiency
of the application and will reduce
the overall application development
time. So we can easily finish our
project within the given
time frame.
Riya
Spring
`
https://www.edureka.co/spring-frameworkEDUREKA SPRING FRAMEWORK CERTIFICATION TRAINING
Oh! That’s really nice. Lets
proceed with Spring then.
Scott
Spring
Spring Framework
`
https://www.edureka.co/spring-frameworkEDUREKA SPRING FRAMEWORK CERTIFICATION TRAINING
What is Spring Framework?
Powerful
open source
Lightweight
application
framework
Reduces the
overall
complexity
Comprehensive
tool
Framework of
frameworks
Avails an
array of
resources
`
https://www.edureka.co/spring-frameworkEDUREKA SPRING FRAMEWORK CERTIFICATION TRAINING
Spring Origin
First version of Spring was first released on
February 2003, By Rod Johnson.
Spring has been hosted on SourceForge since
January 2003.
`
https://www.edureka.co/spring-frameworkEDUREKA SPRING FRAMEWORK CERTIFICATION TRAINING
Spring Framework Ecosystem
Why Spring Framework?
`
https://www.edureka.co/spring-frameworkEDUREKA SPRING FRAMEWORK CERTIFICATION TRAINING
Uses Of Spring Over Other Frameworks
`
https://www.edureka.co/spring-frameworkEDUREKA SPRING FRAMEWORK CERTIFICATION TRAINING
Why Spring is so popular?
Distinct division between JavaBean Models, Controllers and Views
Spring’s MVC is very flexible as it makes use of interfaces
Offers better integration with view technologies other than JSP
Spring’s MVC web tiers are typically easier to test
Well defined interface to business layer
Spring Controllers are configured via IoC
`
https://www.edureka.co/spring-frameworkEDUREKA SPRING FRAMEWORK CERTIFICATION TRAINING
Difference between Spring, Struts2 and Hibernate
Easy integration with client-side technologies
Easy integration with ORM technologies
Tag Library
Loose Coupling
Layered Architecture
Light Weighted
Application Framework
Struts2Spring Hibernate
Spring Architecture
`
https://www.edureka.co/spring-frameworkEDUREKA SPRING FRAMEWORK CERTIFICATION TRAINING
Spring Architecture
Spring Modules
`
https://www.edureka.co/spring-frameworkEDUREKA SPRING FRAMEWORK CERTIFICATION TRAINING
Core Module
Core
Bean
Context
SpEL
Provides the fundamental parts of the
framework.
Provides BeanFactory.
It is a medium to access any objects
defined and configured.
Provides a powerful expression
language.
Core
Container
Data Access
Web
Misc.
`
https://www.edureka.co/spring-frameworkEDUREKA SPRING FRAMEWORK CERTIFICATION TRAINING
Data Access/Integration
JDBC
ORM
OXM
JMS
Transaction
Provides a JDBC-abstraction layer.
Provides an abstraction layer
Provides integration layers for popular
object-relational mapping APIs.
Contains features for producing and
consuming messages.
Supports programmatic and declarative
transaction management
Core
Container
Data Access
Web
Misc.
`
https://www.edureka.co/spring-frameworkEDUREKA SPRING FRAMEWORK CERTIFICATION TRAINING
Web(MVC/Remoting) Module
WebSocket
Servlet
Web
Portlet
Provides basic web-oriented integration
features.
Provides support for WebSocket based a
two-way communication between the client
and the server.
Contains Spring's MVC implementation for
web applications.
Provides the MVC implementation and also
mirrors the functionality of Web-Servlet
module.
Core
Container
Data Access
Web
Misc.
`
https://www.edureka.co/spring-frameworkEDUREKA SPRING FRAMEWORK CERTIFICATION TRAINING
Miscellaneous
AOP
Aspects
Instrumentation
Messaging
Test
Provides an aspect-oriented programming
implementation.
Provides integration with AspectJ.
Provides class instrumentation support and
class loader implementations.
Provides support for STOMP as the
WebSocket sub-protocol to use in apps.
Supports the testing of Spring components.
Core
Container
Data Access
Web
Misc
First Program
`
https://www.edureka.co/spring-frameworkEDUREKA SPRING FRAMEWORK CERTIFICATION TRAINING
Eclipse IDE Installation
Go to
www.eclipse.org
Download Eclipse
Neon installer and
install on your
Windows system
1
2
`
https://www.edureka.co/spring-frameworkEDUREKA SPRING FRAMEWORK CERTIFICATION TRAINING
Installing Spring IDE plugin
Select this3
`
https://www.edureka.co/spring-frameworkEDUREKA SPRING FRAMEWORK CERTIFICATION TRAINING
4
5
Search for
Spring
Select Install
Installing Spring IDE plugin
`
https://www.edureka.co/spring-frameworkEDUREKA SPRING FRAMEWORK CERTIFICATION TRAINING
6 Confirm And
Proceed
Let the
installation
to get
complete
and then
restart the
eclipse.
7
Installing Spring IDE plugin
`
https://www.edureka.co/spring-frameworkEDUREKA SPRING FRAMEWORK CERTIFICATION TRAINING
Bean Class
Xml file
Demo class
Load jar files
Run
Start Coding in 5 Simple Steps
`
https://www.edureka.co/spring-frameworkEDUREKA SPRING FRAMEWORK CERTIFICATION TRAINING
Creating the Bean class
Bean Class
Xml file
Demo Class
Load jar files
Run
getter() method
setter() method
`
https://www.edureka.co/spring-frameworkEDUREKA SPRING FRAMEWORK CERTIFICATION TRAINING
Creating the xml File
Bean Class
Xml file
Demo Class
Load jar files
Run
Providing a bean
To IoC container
`
https://www.edureka.co/spring-frameworkEDUREKA SPRING FRAMEWORK CERTIFICATION TRAINING
Creating the Demo class
Bean Class
Xml file
Demo Class
Load jar files
Run
Injecting a bean file
`
https://www.edureka.co/spring-frameworkEDUREKA SPRING FRAMEWORK CERTIFICATION TRAINING
Loading Spring jar Files
Bean Class
Xml file
Demo Class
Load jar files
Run
`
https://www.edureka.co/spring-frameworkEDUREKA SPRING FRAMEWORK CERTIFICATION TRAINING
Testing The Code
Bean Class
Xml file
Demo Class
Load jar files
Run
Once you are done with creating the source and
beans configuration files, you are ready for this
step, which is compiling and running your
program.
IoC Container
`
https://www.edureka.co/spring-frameworkEDUREKA SPRING FRAMEWORK CERTIFICATION TRAINING
IoC Container Features
Creating the objects
Managing their complete life cycle Configuring
them
Wiring them together
S
P R I N
G
F
R
A
M E W
O
R
KIOC
`
https://www.edureka.co/spring-frameworkEDUREKA SPRING FRAMEWORK CERTIFICATION TRAINING
Spring Container
Final Result
Java POJO Classes
Ready To Use
Application
MetaData
The Spring IoC container by using Java POJO
classes and configuration metadata
produces a fully configured and executable
system or application.
IoC Container Features
`
https://www.edureka.co/spring-frameworkEDUREKA SPRING FRAMEWORK CERTIFICATION TRAINING
Types Of IoC Container
Bean Factory
ApplicationContext
org.springframework.beans.factory.BeanFactory is the
simplest container providing the basic support for
Dependency Injection
IoC
org.springframework.context.ApplicationContext built
on top of the BeanFactory interface. This container adds
more enterprise-specific functionality
Bean
`
https://www.edureka.co/spring-frameworkEDUREKA SPRING FRAMEWORK CERTIFICATION TRAINING
Bean Object
Beans are the objects that form the backbone of our application and are
managed by the Spring IoC container.1
Spring IoC container instantiates, assembles, and manages the bean object2
The configuration metadata that are supplied to the container are used
create Beans object3
IoC
Container
Bean
MetaData
`
https://www.edureka.co/spring-frameworkEDUREKA SPRING FRAMEWORK CERTIFICATION TRAINING
Bean Life Cycle
Instantiate Populate Properties
Call BeanNameAware’s
setBeanName()
Call BeanFactoryAware’s
setBeanFactory()
Call ApplicationContextAware’s
setApplicationContext()
Preinitialize(BeanPostProcessor)
Call InitializingBean’s
afterPropertiesSet()
Call custom-init()
Post Initialization(Bean
PostProcessor)
Call DisposableBean’s destroy() Call custom-destroy()
Bean Is Ready To Use
Container Is ShutDown
Demo on Beans
Dependency Injection
`
https://www.edureka.co/spring-frameworkEDUREKA SPRING FRAMEWORK CERTIFICATION TRAINING
Dependency Injection
It is a design pattern which removes the dependency from the programming code, that makes
the Application easy to manage and test.1
Dependency Injection makes our programming code loosely coupled, which means change in
implementation doesn’t affects the user.2
`
https://www.edureka.co/spring-frameworkEDUREKA SPRING FRAMEWORK CERTIFICATION TRAINING
Types Of Dependency Injection
Spring framework avails two ways to inject dependency :
By Constructor
By Setter method
1
2 The <property> subelement of <bean>
is used for setter injection
The <constructor-arg> subelement of
<bean> is used for constructor injection
`
https://www.edureka.co/spring-frameworkEDUREKA SPRING FRAMEWORK CERTIFICATION TRAINING
Here the instance of Address class is provided by external
source like XML file either by constructor or by setter method
By Constructor
By Setter()
Types Of Dependency Injection
Demo on Dependency
Injection
Thank You …
Questions/Queries/Feedback

Spring Framework Tutorial | Spring Tutorial For Beginners With Examples | Java Framework | Edureka