This Edureka "What Is Spring Framework" tutorial will help you in understanding the fundamentals of Spring Framework and build a strong foundation in Spring. 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. Spring Features
10. `
https://www.edureka.co/spring-frameworkEDUREKA SPRING FRAMEWORK CERTIFICATION TRAINING
Java Framework Principle
Abides the Hollywood Principle that is “Don’t call us, we’ll call you”.
Also called Inversion of flow or Inversion of Control
Class A
Class A
Class C
Class B
Class B
Class C
Injection
Dependency
16. `
https://www.edureka.co/spring-frameworkEDUREKA SPRING FRAMEWORK CERTIFICATION TRAINING
Definition
Spring is a complete and a modular framework
for developing enterprise applications in java.
spring framework can be
used for all layer
implementations for
a real time application
spring can be used for
the development of
particular layer of a
real time application
20. `
https://www.edureka.co/spring-frameworkEDUREKA SPRING FRAMEWORK CERTIFICATION TRAINING
Why Spring Is So Popular ?
S I M P L I C I T Y
T E S TA B L I T Y
L O O S E C O U P L I N G
These 3 are basically the main reasons for its popularity.
Lets now understand how they are exactly making it so
21. `
https://www.edureka.co/spring-frameworkEDUREKA SPRING FRAMEWORK CERTIFICATION TRAINING
T E S TA B L I T Y
L O O S E C O U P L I N G
Simplicity
Spring framework is simple because as it is non-invasive.
It uses POJO and POJI
If a java class is not coupled with any technology (or) any
framework then that java class is called “POJO” (plain old
java class)
public class MyClass
{ …
…
…
}
S I M P L I C I T Y
22. `
https://www.edureka.co/spring-frameworkEDUREKA SPRING FRAMEWORK CERTIFICATION TRAINING
T E S TA B L I T Y
L O O S E C O U P L I N G
Simplicity
If a java interface is not coupled with any technology (or)
any frame work then such java interface is called “POJI”
(plain old java interface)
public interface MyInterface
{ …
…
…
}
S I M P L I C I T Y
23. `
https://www.edureka.co/spring-frameworkEDUREKA SPRING FRAMEWORK CERTIFICATION TRAINING
S I M P L I C I T Y
L O O S E C O U P L I N G
Actually for writing the spring application, server
[Container] is not mandatory because it has it own
container to run the applications
Spring Container
Final Result
Java POJO Classes
Ready To Use
Application
MetaData
Testablity
T E S TA B L I T Y
24. `
https://www.edureka.co/spring-frameworkEDUREKA SPRING FRAMEWORK CERTIFICATION TRAINING
S I M P L I C I T Y
T E S TA B L I T Y
Spring objects are loosely coupled, this is
the core concept of spring framework
class Rider
{
Bike b;
public void setBike(Bike b)
{
this.b = b;
}
void ride()
{
b.start();
}
}
Interface Bike
{
void start();
}
BajajHonda Yamaha
Classes
Spring container will inject either Honda object or Bajaj object
or Yamaha object into the Rider class by calling setter method
Loose Coupling
L O O S E C O U P L I N G
29. `
https://www.edureka.co/spring-frameworkEDUREKA SPRING FRAMEWORK CERTIFICATION TRAINING
Core Container
Data Access/Integration
Web
AOP (Aspect Oriented Programming)
Instrumentation
Test
o The Spring Framework contains a lot of features, which are well-organized in about twenty
modules.
o These modules can be grouped together based on their primary features into following:
Spring Modules
30. `
https://www.edureka.co/spring-frameworkEDUREKA SPRING FRAMEWORK CERTIFICATION TRAINING
CoreContainer
Provide the
fundamental parts
of the framework
Provides
BeanFactory
Supports
internationalizatio
n (I18N), EJB, JMS,
Basic Remoting
Provides a
powerful
expression
language
Core
ContextSpEL
Beans
Modules-Core Container
31. `
https://www.edureka.co/spring-frameworkEDUREKA SPRING FRAMEWORK CERTIFICATION TRAINING
DataAccess
Provides a JDBC-
abstraction layer
Provides
integration layers
Provides an
abstraction
Supports
programmatic and
declarative
transaction
management
JDBC
OXMTransaction
ORM
Contains features
for producing and
consuming
messages
JMS
Modules-Data Access
32. `
https://www.edureka.co/spring-frameworkEDUREKA SPRING FRAMEWORK CERTIFICATION TRAINING
Web
Provides basic
web-oriented
integration
features
Contains Spring's
Model-View-
Controller (MVC)
implementation
Provides support
for WebSocket-
based, two-way
communication
Provides the MVC
implementation
used in a portlet
environment
Web
Web SocketWeb Portlet
Web MVC
Modules-Web
33. `
https://www.edureka.co/spring-frameworkEDUREKA SPRING FRAMEWORK CERTIFICATION TRAINING
Miscellaneous
Provides an
aspect-oriented
programming
implementation
Provides
integration with
AspectJ
Provides class
instrumentation
support and class
loader
implementations
Supports the
testing of Spring
components with
JUnit or TestNG
frameworks
AOP Instrumenting
Test Aspects
Provides support
for STOMP as the
WebSocket sub-
protocol to use in
applications
Messaging
Modules-Miscellaneous
36. `
https://www.edureka.co/spring-frameworkEDUREKA SPRING FRAMEWORK CERTIFICATION TRAINING
IoC Container
The Spring IoC container by using Java POJO
classes and configuration metadata produces a
fully configured and executable system or
application.
Spring Container
Final Result
Java POJO Classes
Ready To Use
Application
MetaData
37. `
https://www.edureka.co/spring-frameworkEDUREKA SPRING FRAMEWORK CERTIFICATION TRAINING
IoC Container
Configured by loading the XML files or by detecting specific Java
annotations on configuration classes.
Two types of IoC containers :
BeanFactory
ApplicationContext
40. `
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
42. `
https://www.edureka.co/spring-frameworkEDUREKA SPRING FRAMEWORK CERTIFICATION TRAINING
Aspect Oriented Programming
Providing modularity with aspect rather than class.1
AOP breaks the program logic into distinct parts called concerns2
A cross-cutting concern is a concern which can affect the entire application4
Increases modularity by cross-cutting concerns3
43. `
https://www.edureka.co/spring-frameworkEDUREKA SPRING FRAMEWORK CERTIFICATION TRAINING
Aspect Oriented Programming
Module 2
Application
Module 3
Crosscutting concern is applicable throughout the application and it affects the entire application modules
Module 1
Cross
cutting
concern
45. `
https://www.edureka.co/spring-frameworkEDUREKA SPRING FRAMEWORK CERTIFICATION TRAINING
Model View Controller
User input is interpreted by the controller and are transformed into a model which is represented to the
user by the view.
Controller
View
Model
Request
Response
User
Browser