This Edureka Spring Framework Tutorial will help you in understanding the fundamentals of Spring Framework and help you in building a strong foundation in Spring with examples. Below are the topics covered in this tutorial:
1. Java Frameworks
2. Spring Framework
3. Why Spring Framework?
4. Spring Architecture
5. Spring Modules
6. IoC Container
7. Dependency Injection
6. `
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.
11. `
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.
16. `
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
17. `
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
20. `
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
25. `
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
26. `
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
30. `
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.
31. `
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.
32. `
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.
33. `
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
44. `
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.
47. `
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
48. `
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
50. `
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
51. `
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
54. `
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
55. `
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
56. `
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