You are on page 1of 12

Introduction to the Spring Framework

By: Nigusse A. Duguma


Kansas State university Department of Computer Science

Nov 20, 2007

Discussion Points

Brief Introduction to Spring


Spring Framework Key Features Overview of the Spring Framework Spring Framework Vs. J2EE Spring DAO

2
By: Nigusse A. Duguma

Nov 20, 2007

What is Spring?

An open source framework created by Rod Johnson. created to address the complexity of enterprise application development

It makes it possible plain JavaBeans to achieve things that were previously only possible with EJBs. Simplicity, testability, and loose coupling

Spring is a framework that helps to develop loosely coupled application code.

"Everything should be made as simple as possible, but not simpler." Einstine

3
By: Nigusse A. Duguma

Nov 20, 2007

Spring Framework Key Features


Core Spring: Inversion Control/Dependency Injection (IoC/DI)

Aspect Oriented Programming (AOP)

Aspect: A modularization of a concern that cuts across multiple objects.

4
By: Nigusse A. Duguma

Nov 20, 2007

Dependency Injection

Objects are passively given their dependencies instead of creating or looking for dependent objects for them selves.

Instead of an object looking up dependencies from a container, the container gives the dependencies to the object at instantiation with out being asked.

Primary approaches to implementing DI:

Constructor injection and Setter injection.


5 Nov 20, 2007

By: Nigusse A. Duguma

Aspect Oriented Programming

Application objects do what they are supposed to do


perform business logic -nothing more

They are not responsible for other system


concerns, such as logging or transaction support

Aspect: A modularization of a concern that cuts across multiple objects.

6
By: Nigusse A. Duguma

Nov 20, 2007

Components of Spring Framework

ORM

Web

Portlet MVC

Remoti ng

AOP

JMX

JCX

JMS

MVC DAO
Context

Core

7
By: Nigusse A. Duguma

Nov 20, 2007

Components of the Spring Framework

Core Container: -it contains the BeanFactory which is


the basis on which Spring DI is based.

Application Context Module The core module's


BeanFactory makes Spring a Container, but the Context module is what makes it a Framework.

AOP Module serves as the basis for developing your


own Aspects for your Spring enabled application.

JDBC abstraction and the DAO- this module uses


the Spring's AOP module to provide transaction management services for the objects in a spring application.
8
By: Nigusse A. Duguma

Nov 20, 2007

Cont.(Spring Framework)

ORM (Object Relational Mapping) Module


builds on the DAO support, providing way to build DAO for several ORM solutions. Spring provides hooks into several popular ORM frameworks including Hibernate,iBATIS,SQL Maps, Java Persistence API, Java Data Objects. Spring comes with its own MVC framework that promotes loose coupling techniques in the web layer of an application.
9 Nov 20, 2007

The Spring MVC Framework

By: Nigusse A. Duguma

Spring vs. EJB3


Feature Simple ORM Persistence Implementation Spring Hibernate, iBatis, JPA JDO,TopLink JDBC, Hibernate, JTA (With JTA) XML Standard
By: Nigusse A. Duguma

EJB3 JPA(Providers include Hibernate, Kodo and TopLink) ? JTA Transactional by default, override with annotations or XML
10

JDBC Support Supported Transaction Types Support for Distributed Transaction Configuration

(With JTA)
Nov 20, 2007

Summary

Key Features of Spring

Dependency Injection & AOP

Components of the Spring Framework Comparison b/n Spring and EJB3

11
By: Nigusse A. Duguma

Nov 20, 2007

References
[1] Spring In Action By. Craig Walls (2007) Second Edition. [2] POJO Application Frameworks: Spring Vs. EJB 3.0 by Michael Juntao Yuan http://www.onjava.com/lpt/a/5996
accessed on Nov 5,2007

[3] Dependency Injection for Loose Coupling -The Code Project


http://www.codeproject.com/cs/design/DependencyInjection.asp

12
By: Nigusse A. Duguma

Nov 20, 2007

You might also like