Frameworks are large prewritten code to which you add your own code to solve a problem in a specific domain.
You make use of a framework by calling its methods,inheritance,and supplying “call-backs” listeners.
Spring is the most popular application development framework for enterprise Java™.
Millions of developers use Spring to create high performing, easily testable, reusable code without any lock-in.
2. • Framework.
• Spring History.
• Key Features of Spring
Framework.
• Spring Architecture.
• Spring Files.
• Steps For Creating Spring Projects.
Overvie
w
2
3. Framework
Frameworks are large prewritten code to which
you add your own code to solve a problem in a
specific domain.
You make use of a framework by calling its
methods,inheritance,and supplying “call-backs”
listeners.
Example Java’s Swing and AWT classes.They
have a huge amount of code to manage the
user interface and there is inversion of control.
3
4. Framework
• Software frameworks may include support
programs, compilers , code libraries , tool sets ,
API , Function, Producer , Datafile.
4
5. Spring
Spring is the most popular application
development framework for enterprise Java™.
Millions of developers use Spring to create
high performing, easily testable, reusable code
without any lock-in.
Open source Java platform since 2003.
Reduces code and speeds up development.
Current Version is 4.0 5
6. Spring layer
Presentation layer – An MVC framework that is most
similar to Struts but is more powerful and easy to use.
Business layer – Lightweight IOC container and AOP
support (including built in aspects)
Persistence layer – DAO template support for popular
ORMs and JDBC
6
7. Spring layer
Presentation Logic Layer
Business Logic Layer
Data Access Layer
PHP,JSP,HTML
Data Base
App Logic
Data StorageBrowser View
Procedures
7
9. Goals
Make J2EE easier to use
Make the common tasks easier
Promote good programming practice.
You can focus on the domain problems.
9
10. Lightweight: Spring Framework is lightweight
with respect to size and transparency.
Container: Spring Framework creates and
manages the life cycle and configuration of
application objects.
Spring supports All types of application
development: We can develop any type of
applications using spring, e.g. Core java, web
Application, Distributed application, Enterprise
application.
Spring Features
10
11. Spring Architecture
The Spring framework is a layered architecture
which consists of several modules.
All modules are built on the top of its core
container.
It's modular architecture enables integration
with other frameworks without much difficulties
11
13. Spring Architecture
The Core Module: This module contains
the Bean Factory, an implementation of Factory
Pattern which creates the bean as per the
configurations provided by the developer in an
XML file.
Core Module
The IOC Container.
13
14. Spring Architecture
The AOP Module: AOP is a useful technique
that enables adding executable blocks to the
source code without explicitly changing it.
AOP to avoid re-implementation of some
common behaviour in multiple classes.
AOP
Spring AOP
AspectJ integration
14
15. Spring Architecture
The DAO Module:- (Data Access Object)
standardizes the data access work using
JDBC, Hibernate or JDO.
This provides an abstraction layer to the low
level task of creating a connection, releasing it
etc.
DAO
Spring JDBC
Transaction
Management
15
16. Spring Architecture
The ORM Module:- Spring doesn’t provides its
own ORM implementation but offers
integrations with popular Object Relational
mapping tools like Hibernate, iBATIS SQL
Maps, Oracle TopLink and JPA etc.
ORM
Hibernate
JPA,JDO,OJB
16
17. Spring Architecture
The JEE Module:- It also provides support for
JMX, JCA, EJB and JMS etc.
JCA (Java EE Connection API).
EJB (Enterprise JavaBeans).
JMS (Java Message Service).
JEE
EJB
JMS
17
18. Spring Architecture
The Web Module:- Spring comes with MVC
framework which eases the task of developing
web applications.
It also integrates well with the most popular
MVC frameworks like Struts, Tapestry, JSF,
Wicket etc.
18
20. Spring Project File
Application Context.xml
The Application Context is Spring's advanced
container. Similar to Bean Factory, it can load
bean definitions.
This container is defined
by org.springframework.context.ApplicationCont
e xtinterface.
20
21. Spring Project File
The most commonly used Application
Context implementations.
1. FileSystemXmlApplicationContext − Here you need
to provide the full path of the XML bean configuration
file.
2. ClassPathXmlApplicationContext − Here you do not
need To provide the full path of the XML file but you
need to set CLASSPATH.
3. WebXmlApplicationContext − This container loads
the XML file with definitions of all beans from within a21
22. Spring Project File
Dispatcher-servlet.xml
The Spring Web model-view-controller (MVC)
framework is designed around a Dispatcher
Servlet that handles all the HTTP requests and
responses.
22
23. Spring Project File
Web.xml
The /WEB-INF/web.xml file is used to define
how to deploy the web module to a Servlet
container like JBoss, Tomcat, Glassfish or any
other servlet container.
Basically web.xml tell container all servlets in
the web application with <servlet> element , then
tell container when to use which servlet by the url
mapping with <servlet-mapping> element.
23
24. Steps For Creating Project
Step 1:- Creating Projects and Select Java
Web Application.
24
25. Steps For Creating Project
Step 2:- Write a Name of Java Application
Projects And Click Finish.
25
26. Steps For Creating Project
Step 3:- Select Spring Web MVC
Frameworks.
26