Spring Framework - Clarence

helpflightInternet and Web Development

Nov 10, 2013 (3 years and 7 months ago)

77 views

Spring Framework
Overview and Tools

Clarence Ho

www.skywidesoft.com

Topics

What is Spring framework
?


Why Spring framework?


Spring framework architecture


Spring framework and JEE 6


Spring main features


Usage scenario


Development tool
(
SpringSource

Tool Suite)

2

What is Spring Framework?

3

What is Spring framework?

Light
-
weight yet comprehensive framework
for building
Java
applications


Web applications


Enterprise applications


Desktop applications


Batch application


Integration/SOA application

4

Key Features
-

DI

JavaBeans
-
based configuration
management, applying
Inversion
-
of
-
Control
principles, specifically
using the
Dependency Injection (
DI)
technique


This aims to eliminate manual wiring of components


A core bean factory, which is usable
globally


Spring MVC uses it internally

5

Key Features
-

Persistence

Generic abstraction layer for
database transaction
management


Higher abstraction over JDBC


Integration with persistence frameworks such
as
Hibernate
, JPA

6

Key Features


Web Tier

Spring MVC web application framework, built
on core
Spring functionality, supporting
many technologies
for
generating views,
including JSP
,
JSF,
Facelets
,
FreeMarker
,
Velocity,
Tiles,
iText
, and POI(Java API to Access
Microsoft
Format
files
).


Comprehensive support of
RESTful

Web Services


Spring Web Flow
-

fine
-
grained
navigation

7

Key Features
-

AOP

Extensive aspect
-
oriented programming (
AOP)
framework
for providing services such
as transaction
management, security
support


As with the Inversion
-
of
-
Control parts of the
system, this
aims
to improve the modularity of
systems created
using the
framework
.

8

Why Use Spring Framework?

9

Why Use Spring?

Wiring components (JavaBeans)
through Dependency
Injection


Promotes de
-
coupling among the parts that make
up an
application


Design to
interfaces


Insulates a user of a functionality from
implementation details


Test
-
Driven Development (TDD
)


POJO classes can be tested without being tied up
with the
framework

10

Why Use Spring? (Continued)

Declarative programming through
AOP


Easily configured aspects,
especially transaction support


Simplify use of popular
technologies


Abstractions insulate application from
specifics, eliminate
redundant
code


Underlying technology specifics still
accessible


Handle common error conditions

11

Why Use Spring? (Continued)

Conversion of checked exceptions
to unchecked


E.g

SQLException

to
DataAccessException


Not an all
-
or
-
nothing
solution


Extremely modular and
flexible


Well
designed


Easy to
extend


Many reusable classes

12

Why Use Spring? (Continued)

Integration with other
technologies


EJB (for Java EE applications
)


JPA, Hibernate,
MyBatis

(formerly
iBatis
),
JDBC (for data
access)


V
elocity
, etc. (for presentation
)


JSF, Wicket, Struts,
etc

(For
Web)

13

Spring Framework
Architecture

14

Spring Framework Architecture
15

Spring Framework and JEE 6

16

JEE 6


Features/API Overview

17

Spring Framework


Features/API Overview

18

JEE
vs

Spring


Features/API Overview

19

* Similar patterns for validation,
remoting
, security, scheduling, XML binding, JMX, JCA,
JavaMail
, caching

* Spring also support EJB 3.1, but not CDI

Spring Main Features

20

Spring Framework


Main Features
21

Feature

Description

Sub
-
proj
.

IOC

Container

Configuration of application components and lifecycle management of Java
objects, done mainly via Dependency Injection

AOP

Enables implementation of cross
-
cutting routines

Data Access

Working with relational database management systems on the Java platform
using JDBC and object
-
relational mapping tools and with
NoSQL

databases

Spring Data
projects

Transaction
Management

Unifies several transaction management APIs (JDBC, JPA, JTA, etc.) and
coordinates transactions for Java objects.

Model
-
view
-
controller

An HTTP
-

and servlet
-
based framework providing hooks for extension and
customization for web applications and
RESTful

Web Services.

Authentication

&
Authorization

Configurable security processes that support a range of standards, protocols,
tools and practices via the Spring Security sub
-
project

Spring
Security

Remote
Management

Configurative exposure and management of Java objects for local or remote
configuration via JMX

Messaging

Configurative registration of message listener objects for transparent
message
-
consumption from message queues via JMS, improvement of
message sending over standard JMS APIs

Testing

support classes for writing unit tests and integration tests

Spring Framework


Latest Features (3.x)
22

Feature

Description

Version

Java
-
based Configuration

Use Java classes to configure Spring’s
䅰pli捡瑩cn䍯n瑥tt

(Spring
JavaConfig

was merged into the core Spring Framework

since
3.0).

3.0

Embedded

JDBC
DataSource

Embedded database support (by

using the
<jdbc:embedded
-
database
id="dataSource" type="H2"> tag)

3.1

Validation with

Type
Conversion and Formatting

Spring

3 introduce a new type conversion and formatting system, and
support of JSR303 Bean Validation API.

3.0

Persistence with Spring
Data JPA

Spring

Data JPA’s Repository abstraction greatly simplifies the
development of persistence layer with JPA.

3.0

Spring

MVC

Improved

support of
RESTful
-
WS.

3.1

Spring Expression Language

A powerful

expression language that supports querying and manipulating
an object graph at run time.

3.0

Profiles

A profile instructs Spring to configure only the

ApplicationContext

that
was defined

when the specified profile was active

3.1

Cache Abstraction

A caching abstraction layer that allows consistent use of

various caching
solutions with minimal impact on the code.

3.1

TaskScheduler

Abstraction

Provides a simple way to schedule tasks and supports most

typical requirements.

3.0

Usage Scenarios

23

Usage Scenarios

You can use Spring in all sorts of
scenarios, from
applets
up to fully
-
fledged
enterprise applications
using Spring's
transaction management
functionality and web
framework
integration

24

Typical Full
-
fledged Spring Web

Application
25

Spring Middle
-
tier Using
3
rd

party

Web Framework
26

Remoting

Usage Scenario
27

Other Useful Spring Projects
28

Project

Description

Versio
n

Spring Security

Configurable security processes that support a range of standards,
protocols, tools and practices

3.1.2

Spring Data

An

umbrella project includes many modules that simplifies the
development of persistence layer with various data sources (e.g. JPA,
NoSQL
, JDBC,
Hadoop
, etc.)

1.X

Spring Batch

Provides a standard template and framework for implementing and
executing various

kinds of batch jobs in an enterprise environment.

2.1.8

Spring Integration

Provides an excellent integration environment for enterprise

applications.

2.1.3

Spring
WebFlow

Building on top of Spring MVC’s foundation, Spring Web Flow was
摥獩杮敤e瑯 pro癩v攠慤癡湣敤

獵ppor琠fo爠o牧慮r穩n朠瑨攠晬f睳win獩s攠愠
web application.

2.3.1

Spring Mobile

An extension to Spring MVC that aims to simplify the development of
mobile web applications.

1.0.0

Development Tool

29

SpringSource

Tool Suite (STS)

Eclipse
-
powered development environment
for building
Spring
-
powered enterprise
applications


Supports Java, Spring, Groovy and
Grails


Comes with developer edition of
vFabric

tc

Server


vFabric

tc

Server is Tomcat that is optimized
for Spring

30

Eclipse and Tomcat

You can use Eclipse and Tomcat for
building and
deploying
Spring application


You have to install “
m2e”
Maven
plug
-
in's to
Eclipse IDE
yourself


Core and WTP “
m2e”
plug
-
in's


You have to install and configure Tomcat
to Eclipse
IDE
yourself

31

32

Thank You!

Clarence Ho

www.skywidesoft.com