Top Banner
 1 Spring Framework SPRING FRAME WORK By ANKU R TRAPASIYA (201112040) Abstract: A Software Framework is set of reusable software program that forms the platform for the development of the web based applications. Frameworks help the programmers to build the web application very easily with all the essential features provided. Few years back it was very hard to develop complex web applications but now a day there are very large set of frameworks are available which allows developing web applications whether it be a simple or complex very easily. Spring is one of the very powerful frameworks for development of web based applications in java platform. Spring is a lightweight framework which provides an inversion of control and aspect-oriented container framework. About 47% of the Java shops use  java based spring framework. Spring in the development increases the performance of the enterprise applications, reduces the cost and separates the concerns of the application development. It is alternative for the EJB(Enterprise Java Beans) which are considered as the complex thing in the development world. This paper aims to provide the overview of the spring framework, its capabilities and its features such as IOC(Inversion of Control), AOP(Aspect Oriented Programming) and MVC(Model View Controller) etc. The paper also discusses the advantages and disadvantages associated with the spring.  
24

Spring Doc Final

Apr 07, 2018

Download

Documents

Trapassiya_191
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Spring Doc Final

8/3/2019 Spring Doc Final

http://slidepdf.com/reader/full/spring-doc-final 1/24

 1 Spring Framework

SPRING FRAMEWORK

By

ANKUR TRAPASIYA

(201112040)

Abstract: A Software Framework is set of reusable software program that forms the

platform for the development of the web based applications. Frameworks help the programmersto build the web application very easily with all the essential features provided. Few years back it

was very hard to develop complex web applications but now a day there are very large set of 

frameworks are available which allows developing web applications whether it be a simple or

complex very easily. Spring is one of the very powerful frameworks for development of web

based applications in java platform. Spring is a lightweight framework which provides an

inversion of control and aspect-oriented container framework. About 47% of the Java shops use

  java based spring framework. Spring in the development increases the performance of the

enterprise applications, reduces the cost and separates the concerns of the application

development. It is alternative for the EJB(Enterprise Java Beans) which are considered as the

complex thing in the development world. This paper aims to provide the overview of the spring

framework, its capabilities and its features such as IOC(Inversion of Control), AOP(Aspect

Oriented Programming) and MVC(Model View Controller) etc. The paper also discusses the

advantages and disadvantages associated with the spring.  

Page 2: Spring Doc Final

8/3/2019 Spring Doc Final

http://slidepdf.com/reader/full/spring-doc-final 2/24

 2 Spring Framework

Index

Sr. No Content Description Page No.

1 Introduction 3

2 Spring-An alternative to EJB 4

3 Spring Architecture 6

4 Spring Features 9

5 Advantages 21

6 Disadvantages 22

7 Conclusion 23

8 Bibliography 24

Page 3: Spring Doc Final

8/3/2019 Spring Doc Final

http://slidepdf.com/reader/full/spring-doc-final 3/24

 3 Spring Framework

1.  Introduction:

The Spring Framework is an open source application framework since February 2003

for the Java platform. It was developed by Rod Johnson who released the framework in his

book “Expert One-on-One J2EE Design and Development” in October 2002. The framework 

was first released under the Apache 2.0 license in June 2003. The first stable release 1.0 was

released in March 2004, with further stable releases in September 2004 and March 2005. The

Spring 1.2.6 framework won a Jolt productivity award and a JAX Innovation Award in

2006. In December 2009 version 3.0 GA was released. The current version is 3.0.6. The core

features of the Spring Framework can be used by any Java application; furthermore it provides

extension for developing web based applications on the top of J2EE. Although the Spring

Framework does not impose any specific programming model, it has become popular in the Java

community as an alternative to, replacement for, or even addition to the Enterprise

JavaBeans (EJB) model. Spring uses normal POJO(Plain Old Java Object) and POJI(Plain Old

Java Interface) to get all the work done which can be done by EJB. However there is a lot of 

investment done in EJBs in enterprise applications so that spring does also support for EJB

thereby keeping the already done investments.

Spring's main aim is to make J2EE(Java 2 Enterprise Edition) development easier and

promote good programming practice in the development. It achieves this goal by enabling a

POJO-based application programming model which is adopted by wide variety of applicationframeworks like JSF(Java Server Faces).

Spring follows the software engineering principle of not reinventing the wheel. It has no

connection pooling framework, no logging packages and no distributed transactions provider. All

this facilities are provided by various open source projects like Log4J, Commons Logging and

there are packages available for distributed transaction processing and connection pooling. So

spring encourages uses of the existing sources. For the same reason it does not provide any

OR(Object Relational) mapping framework also because it is already provided by hibernate,

JPA(Java Persistence API) etc. Spring aims to make existing technologies easier to use and

integrate them easily with the system. For example, although spring’s goal is not to provide low-

level transaction management, it provides an abstraction layer over JTA(Java Transaction API). 

Page 4: Spring Doc Final

8/3/2019 Spring Doc Final

http://slidepdf.com/reader/full/spring-doc-final 4/24

 4 Spring Framework

2.  Spring  – an alternative to EJB 

EJB developed in 1988 and it has established standard and specification in Enterprise

world for developing enterprise level applications which needs distributed processing,

scheduling and persistence capabilities. There are a number of open source java technologies but

there is no comparison of these technologies to the EJBs, EJBs are superior to any of these

technologies. EJB is a standard which has a large industry support. EJBs have been used in

various enterprise projects. With the community support the development with EJB has become

easier. There are many EJB application servers which include IBM WebSphere, Oracle

WebLogic Server, and GlassFish Server etc.

EJB is developed mainly for the enterprise applications which needs remote transaction

and distributed objects for business needs. Some enterprise projects might not need the level of 

the complexity that can be done with the EJBs and it can cause the simple applications to

become complex. EJBs are complex to use especially when it comes to error detecting then EJBs

are very tough to work with. In such cases Spring can be an alternative. In spring, simple POJOs

can be used to get the functionality like EJBs. The goal of Spring Framework is to simplify the

conventional J2EE development and ease the process of unit testing.

Thereby, it has the following advantages over EJB: 

  While using EJB if one wants to test the EJBs then it must be deployed in the application

server which is not the case with the Spring.

  Spring uses plain POJO which follows the JavaBeans naming conventions so that the

developer finds it easy to work with.

  With EJBs if one wants to implement AOP, interceptors has to be used which are error

prone in some cases and are not predictable. While the AOP in Spring is implemented

using configuration files and is easy to work with than EJB Interceptors.

  Spring is flexible in the development since it is relying more over the configuration files

which are easier to modify.

Spring itself is an entire application development framework. There are plenty of the frameworks

for the enterprise java development like Struts, JSF, Tapestry, Wicket, Hibernate, IceFaces,

Page 5: Spring Doc Final

8/3/2019 Spring Doc Final

http://slidepdf.com/reader/full/spring-doc-final 5/24

 5 Spring Framework

MyFaces etc. but when it comes about the integration with enterprise application then additional

framework has to be used to do this. Spring tries to remove this problem by providing a all in one

framework, which provides following functionalities:

  A Core Bean Container.

  An MVC framework.

  An AOP integration framework.

  A JDBC abstraction framework.

  An EJB integration framework.

  OR Mapping Framework

Spring is an layered framework which has different layers of the application development. The

architecture of the Spring is discussed the next.

Page 6: Spring Doc Final

8/3/2019 Spring Doc Final

http://slidepdf.com/reader/full/spring-doc-final 6/24

 6 Spring Framework

Spring Architecture:

Spring is well-organized architecture consisting of seven modules. They are described as

following:

Page 7: Spring Doc Final

8/3/2019 Spring Doc Final

http://slidepdf.com/reader/full/spring-doc-final 7/24

 7 Spring Framework

1)  Spring AOP: 

One of the most important key components of the Spring. AOP provides declarative

enterprise services, especially as a replacement for EJB declarative services. Such service

includes declarative transaction management, logging and interception. It allows users to

implement custom aspects using AOP.

2)  Spring ORM: 

The Spring ORM package relates to the persistence. Persistence refers to the data

access from the underlying database. Spring provides support for the integration with the

popular frameworks like Hibernate, iBatis and JDO(Java Data Objects). Spring provides

generic exception hierarchies and transaction for all the ORM frameworks thereby

generalizing the development process.

3)  Spring Web 

The Web context module builds on top of the application context module,

providing contexts for Web-based applications. As a result, the Spring framework 

supports integration with Jakarta Struts. The Web module also eases the tasks of handling

multi-part requests and binding request parameters to domain objects.

4)  Spring DAO 

Spring DAO(Data Access Objects) provides an abstraction over the standard

JDBC(Java Database Connectivity) development. It provides its own exception hierarchy

for managing exceptions thrown by different database vendors. Thus It simplifies theexception handling and reduces the code required for the error handling in the

application. It is independent of the database vendor.

Page 8: Spring Doc Final

8/3/2019 Spring Doc Final

http://slidepdf.com/reader/full/spring-doc-final 8/24

 8 Spring Framework

5)  Spring Context  

The Spring context contains information related to the application context whichincludes enterprise application services like security, SSL(Secure Socket Layer),

Internationalization and localization, global parameters, Validation and conversion

configuration, JNDI(Java Naming And Directory Interface) configuration and lookup,

Role management, schedulers etc.

6)  Spring Web MVC 

Spring Web MVC provides support for the development of the standard Model-

View-Controller architectural pattern which separates the concerns for the development

team. By using MVC pattern the development becomes faster and change management is

very easy. Application maintenance becomes effective and less error prone with MVC

implementation. Spring provides various interfaces and classes to implement MVC

Pattern.

7)  Spring Core 

The Spring core package contains core classes for effective spring

implementations. The BeanFactory class which is responsible for implementing the IoC

container is the part of this package. Also the AOP implementation is also the

responsibility of this package. All the basic classes for the web application development

reside in this package and they can be implemented or extended by any other class to

provide more functionality.

Page 9: Spring Doc Final

8/3/2019 Spring Doc Final

http://slidepdf.com/reader/full/spring-doc-final 9/24

 9 Spring Framework

3.  Spring Features

There are various features provided by the spring framework which are:

  Inversion of Control

  Transaction Management

  Data Access Framework

  Aspect-Oriented Programming

  Model-View-Controller Framework

  Remote Access Framework

  Batch Processing

  Authentication and Authorization

  Remote Management

  Messaging

  Testing

Page 10: Spring Doc Final

8/3/2019 Spring Doc Final

http://slidepdf.com/reader/full/spring-doc-final 10/24

 10 Spring Framework

4.1 Inversion of Control

Inversion of Control is the heart of the Spring Framework which provides a easy way of 

configuring and managing Java Objects. The container manages object life cycle events like

creating objects, calling initialization methods and configuring the object by wiring them

together whenever dependency arises. Objects created by the container are also called Managed

Objects or Beans. Container does its job by reading XML(Extensible Markup Language) files

which contains information related to the bean definitions and its dependencies from which

container can create the objects. In the container the objects can be found by Dependency lookup

or dependency Injection. Dependency lookup is the pattern where the application requests the

object either by its name or its type. Dependency injection refers to the injecting the live objects

from the container managed pools into the beans via properties, constructors or interfaces. Spring

has IoC container which supports Dependency Injection. The Spring container provides an

effective mechanism to configure web applications, beans and facility to integrate with almost all

Java environments.

The two main types of Inversion of Control are:

4.1.1 Dependency Lookup:

Here the container manages the lookup table for the recent objects and the applications

which needs any dependency provides the name of the dependency or its type and container

looks up in the lookup table whether the dependency is available or not. If it is available then

container returns the dependency to the caller application. The lookup can also be made using

JNDI which is more common to the Java Applications.

4.1.2 Dependency Injection: 

In this type of the container the object doesn’t have to worry about the dependency. Here

the container looks up for the dependencies and injects them into the requesting beans if they are

available. Thus is, dependencies are injected into objects. Here the lookups are not maintained

so that the beans can be used in another container also. Container can create the required

Page 11: Spring Doc Final

8/3/2019 Spring Doc Final

http://slidepdf.com/reader/full/spring-doc-final 11/24

 11 Spring Framework

dependencies to inject in the bean.

There can be three type of dependency injection

1) 

Setter Injection (through property)2)  Constructor Injection.

3)  Interface Injection.

Out of these three spring support first two types of dependency injection.

4.1.2.1 Setter Injection

This injection is done by calling setter method of the dependency property. First the bean has to

be instantiated using no argument constructor or factory methods.

Here is an example of Setter Injection.

- Java Code

public class Test{

 // the Test has a dependency on the TestD private TestD test;

 // a setter method so that the Spring container can 'inject' a TestD public void setTest(TestD test) {

this.test = test;}

 // business logic}

- Configuration XML

<bean id=”testBean” class=”sample.Test”> 

<property name=”test”> 

<ref bean=”testBean2”/> </property>

</bean>

4.1.2.2 Constructor Injection

Constructor injection is being done by injecting arguments to the constructor via theconfiguration file.

Page 12: Spring Doc Final

8/3/2019 Spring Doc Final

http://slidepdf.com/reader/full/spring-doc-final 12/24

 12 Spring Framework

Here is an example for the constructor injection.

- Java Code

public class Test{

 // the Test has a dependency on the TestD 

private TestD test;

 // a constructor so that the Spring container can 'inject' a TestD 

public Test(TestD test) {this.test = test;

}

 // business logic}

- Configuration XML

<bean id=”testBean” class=”sample.Test”> 

<constructor-arg index=0><ref bean=”testBean2”/> 

</constructor-arg>

</bean>

Page 13: Spring Doc Final

8/3/2019 Spring Doc Final

http://slidepdf.com/reader/full/spring-doc-final 13/24

 13 Spring Framework

4.2 Transaction Management Framework

Spring has a powerful Transaction Management Framework which is a generic

abstraction layer over the traditional Transaction APIs. Therefore developer can provide

pluggable transaction managers which makes the demarcation of the transactions easy without

dealing with any low level issues. Spring has independent transaction support so that it is no ties

to J2EE platform and it can also be used where container is not present. Thus Springs transaction

management provides an abstraction over the management of the transactions and it is capable

of:

  Can work with local transactions which does not require application server as well as

global transaction which requires an application server.

  Can work with transactions within the transactions which are termed as nested

transactions.

  Can work with transaction safepoints which can be used to recover the aborted

transactions.

  Can work with almost all the supported Java Environment.

With comparison to Spring the traditional Java Transaction API (JTA) provides only global

transactions and nested transactions and application server must be there to support transactions.

The Spring Framework has a PlatformTransactionManager which handles a number of 

transaction management strategies:

  Transactions managed on resources such as object databases.

  Transactions managed on ORM.

  Transactions managed via the JTA TransactionManager and UserTransaction

  Transactions managed on JDBC Connections.

Page 14: Spring Doc Final

8/3/2019 Spring Doc Final

http://slidepdf.com/reader/full/spring-doc-final 14/24

 14 Spring Framework

Transaction Management can be added to the application in two different ways:

  By using configuration files or Java Annotations.

  By programmatically using Springs TransactionTemplate.

Spring’s Data Access Framework integrates the Transaction Management Framework so that it is

possible to set up a transactional system which does not rely on JTA or EJB. Furthermore, The

Transactional Framework integrated with Messaging and Caching Engines.

Page 15: Spring Doc Final

8/3/2019 Spring Doc Final

http://slidepdf.com/reader/full/spring-doc-final 15/24

 15 Spring Framework

4.3 Data Access Framework

The main process of any enterprise application is: Data Persistence. To load the persisted

data container firstly initializes the Data Access Framework, manages dependent resources,

handle data fetching or connectional related exceptions and if there is any error then in order to

save the existing data it roll backs the action. Spring Data Access Framework addresses the

common difficulties the developers face while dealing with the database and provides standard

solution for that. Spring provides support for all the popular data persistence frameworks like

iBatis, JDBC, Hibernate, JPA, JDO etc.

For all of these supported frameworks, Spring provides these features:

  Resource manage ment  – management of resources which include automatically

acquiring and releasing database resources.

  Exception handling  – handling the exceptions that occur during the database operations

and translating those exceptions into a Spring data access exception hierarchy.

  Resource unwrapping  – deals with the retrieval of the database objects from connection

pool wrappers which contains managed connections.

  Abstraction provides support for BLOB(Binary Large Object) and CLOB(Character

Large Object) handling which deals with binary and character long data.

For each supported framework spring provides template classes. By using these classes

the above functionalities can be achieved. Together with Spring's transaction management, Data

Access Framework offers a flexible solution for working with Data Access Frameworks. The

Spring Framework doesn't has a common data access API, instead it allows the developer use the

entire supported APIs. The spring framework is the only framework in which the managed data

can be accessed outside of the application server or container.

There are two distinct classes for data access process in Spring: Template and Callback.

Template classes manages the fixed part of data access like data connection, managing resources,

controlling transaction etc. while the Callback class defines the things like creating statements,

binding parameters which are related to the application.

Page 16: Spring Doc Final

8/3/2019 Spring Doc Final

http://slidepdf.com/reader/full/spring-doc-final 16/24

 16 Spring Framework

4.4 Aspect-Oriented Programming Framework

The Spring Framework has its own AOP framework which can be used to provide basic

AOP features without too much complexity in design, implementation or configuration. The

Spring AOP framework takes full advantage of the Spring Container and it is configured at

runtime and is interception based. Since it is configured at runtime there is no compilation load

associated with it. Interception is an implementation of AOP. Interception is allowed for only the

execution of public and protected method of existing objects, it is not allowed in private

methods. Spring uses AspectJ framework to provide AOP functionality. Any object which is

created and configured by the container can be enriched using Spring AOP. The Spring

Framework uses Spring AOP internally for transaction management, security, remote access,

and JMX(Java Management Extensions).

There are two approached to AOP configuration:

  Schema-based approach.

  @AspectJ-based annotation style.

AOP is a new programming technique that provides separation of concerns within the

system like logging of the access to the system resources, managing the transactions taking place

etc. which are different level of the requirement in the system. They are additional requirements.

Although they are compulsory to implement they can be treated as independent services and

therefore using functionality like AOP one can separate the concerns so that bug tracking and

managing the functionalities become very easy. A System can have more than one modules

which are responsible for providing any one specific functionality desired by the system.

Whatever may be the core functionality of the application, the system services like transaction

management, logging, security etc., must be included in the application. These system services

are independent of the application code and are configured using XML files. AOP  makes it

possible to separate and modularize these system services and then applies them declaratively to

the components and one can focus on his own specific concerns. In Spring, like the JavaBean,

aspects are wired into objects in the Spring XML file which is known as 'Weaving'.

Page 17: Spring Doc Final

8/3/2019 Spring Doc Final

http://slidepdf.com/reader/full/spring-doc-final 17/24

 17 Spring Framework

4.5 Model-View-Controller Framework

Spring MVC is a request-based or more properly an Action-based framework. Spring defines

interfaces for all of its functionalities. The goal of such interface is that it is easy for Spring

MVC users to write their own implementations of specific functionality if they want. MVC

paves the way for cleaner front end code. All interfaces are tightly coupled to the Servlet API.

This tight coupling to the Servlet API is seen by some as a failure on the part of the Spring

developers to offer a high-level abstraction for web-based applications. However, this coupling

makes sure that the features of the Servlet API remain available to developers while offering a

high abstraction framework to ease working with said API.

The DispatcherServlet class is the front controller of the framework and is responsible for

delegating control to the various interfaces during the execution phases of a HTTP(Hypertext

Transfer Protocol) request.

The most important interfaces defined by Spring MVC, and their responsibilities, are listed

below:

  HandlerMapping: selecting objects which handle incoming requests (handlers) based on

any attribute or condition internal or external to those requests.

 HandlerAdapter: execution of objects which handle incoming requests.

  Controller: comes between Model and View to manage incoming requests and redirect

to proper response. It essentially is like a gate that directs the incoming information. It

switches between going into model or view.

  View: responsible for returning a response to the client. It is possible to go straight to

view without going to the model part. It is also possible to go through all three.

  ViewResolver: selecting a View based on a logical name for the view (use is not strictly

required).

  HandlerInterceptor: interception of incoming requests comparable but not equal

to Servlet filters (use is optional and not controlled by DispatcherServlet).

  LocaleResolver: resolving and optionally saving of the locale of an individual user.

  MultipartResolver: facilitate working with file uploads by wrapping incoming requests.

Page 18: Spring Doc Final

8/3/2019 Spring Doc Final

http://slidepdf.com/reader/full/spring-doc-final 18/24

 18 Spring Framework

All the interfaces which are described above has an important responsibility in the

framework. The abstraction details offered by these interfaces are powerful because we can

implement our own implementation from the interfaces. These interfaces are operating on the topof the Servlet API. Any developer can write their own implementations using these interfaces.

To store key and value pair java.util.Map interface is used in Spring MVC.

One advantage that we get from this Spring MVC framework is ease of the testing. Inversion of 

Control and DispatcherServlet which acts as a controller are tightly coupled with each other.

Developers are free to choose whether they want to implement MVC or not. If they don’t want

MVC functionality then also they can use the remaining all the functionalities of the framework.

The basic purpose of the MVC design pattern is to separate the concerns of the application

development. A good java programmer may not know anything about the HTML so that it is not

the case that he can’t be a part of the project. Same is with the case of fr ont end designers, they

are excellent at designing part but they might not know the java at all. So that MVC framework 

allows all the persons to work according to their skill set. Model part contains POJO so that Java

Programmer can focus on developing the beans only and View part contains the presentation part

so that front end designers can focus only on design part. Their job is to use the beans provided

by the programmer and make proper web interface. Controller part is the configuration part. So

that any Java expert can use it independently. Thus using MVC we can define the roles of the

people and according to that development can move ahead.

Page 19: Spring Doc Final

8/3/2019 Spring Doc Final

http://slidepdf.com/reader/full/spring-doc-final 19/24

 19 Spring Framework

4.6 Remote Access Framework

Spring’s Remote Access Framework deals with RPC-based(Remote Procedure Call)

technologies available on java platform for exporting objects on the servers and client

connectivity. This is one of the Spring’s important feature because it eases the configuration and

encourages the usage of these technologies as much as possible by combining Inversion of 

Control and AOP. Remote Access Framework basically deals with the connecting the client

application with the server hosted at specific web location and exchanging the objects through

the network in specified protocol. Spring’s Remote Access Framework also provides fault-

recovery service which is automatic connecting to the remote location after the connection

failure with the destination.

For Remote access Spring has in built support for the following Protocols:

  HTTP-based protocols 

  Hessian (maintained by CORBA), RMI(1), RMI(2), RMI-IIOP(CORBA).

  Enterprise JavaBean Client Integration 

  Local EJB stateless session bean connectivity, Remote EJB stateless session beanconnectivity.

  SOAP 

  Support for Web Services.

4.7 Batch Framework

Batch processing can be defined as execution of the predefined jobs without manual

intervention. Spring supports Batch Processing and it has Spring Batch Framework for this. It is

a lightweight and comprehensive solution which is designed to satisfy the needs of the enterprise

applications which has a lot of transactions happening daily. So that using this Batch Framework 

developer can develop robust batch applications. Spring Batch Framework provides reusable

functions that are essential in processing large volumes of records including transaction

management, logging/tracing, job processing statistics, job restart, skip, and resource

management. Spring Batch Framework also provides advanced technical features that will enable

extremely high volume and high performance batch jobs through partitioning and optimization

techniques.

Page 20: Spring Doc Final

8/3/2019 Spring Doc Final

http://slidepdf.com/reader/full/spring-doc-final 20/24

 20 Spring Framework

4.8 Authentication and Authorization

J2EE has JAAS(Java Authentication And Authorization Service) which is platform for

Authentication and authorization support. Similarly, Spring provides configurable security

processes that support a range of standards, protocols, tools and practices via the Spring

Security sub-project (formerly Acegi Security System for Spring). In April 2008 it released with

the new name Spring Security 2.0.0.

4.9 Remote Management

It deals with configurative exposure and management of Java objects for local or remote

configuration via JMX(Java Management Extensions).

4.10 Messaging

Spring provides configurative registration of message listener objects for transparent

message consumption from message queues via JMS (Java Messaging Services), improvement

of message sending over standard JMS APIs.

4.11 Testing

Support classes for writing unit tests and integration tests

Page 21: Spring Doc Final

8/3/2019 Spring Doc Final

http://slidepdf.com/reader/full/spring-doc-final 21/24

 21 Spring Framework

4.  Advantages of using Spring Framework

  Spring acts as a lightweight container so that no other container to deploy the application

is needed. Therefore unlike EJBs it doesn’t depend on the JNDI calls.  

  Spring provides a very clean division between controllers, JavaBean models, and views.

  Spring provides AOP through which system services such as logging, security and

transaction management are managed declaratively through configuration files.

  Developer doesn’t have to use JSP(Java Server Pager) necessarily to render the views

instead he can use the view technologies of his choice such as Velocity, XLST(Extensible

Stylesheet Language) etc. Furthermore if developer wants his own custom view then

through templates he can easily implement his own view.

  Spring Controllers which are configured using IoC makes testing of the modules easier

and helps to integrate the managed object easily.

  The Spring web tiers are loosely coupled to the Dispatcher Servlet so that they are easier

to test.

  MVC support makes web tier a thin layer over the top of the business layer. Spring

provides integrated framework for the development of all the tiers in the enterprise

application.

  More testable code since validation has no dependency on Servlet API.

  Effective error handling than JDBC error handling.

  It promotes decoupling and reusability in the application.

  Allows extensibility because it depends upon the interfaces heavily rather than depending

upon the classes.

Page 22: Spring Doc Final

8/3/2019 Spring Doc Final

http://slidepdf.com/reader/full/spring-doc-final 22/24

 22 Spring Framework

5.  Disadvantages

  One has to be well versed experienced with J2SE, J2EE and the concept of application

server (container) in order to start development with Spring.  

  Since there is much configuration code written in XML, it reduces the readability of thecode for the developer.  

  Spring has extensive number of classes so that while creating web archive for the

application all the spring packages also have to be archived which makes archive very

bulky in terms of the size.  

Page 23: Spring Doc Final

8/3/2019 Spring Doc Final

http://slidepdf.com/reader/full/spring-doc-final 23/24

 23 Spring Framework

6.  Conclusion

The Spring Framework aims to make J2EE development easier and manageable. Spring

aims to help the structure whole applications in productive and consistent manner by pulling

together best of breed single tier framework to create a coherent architecture unlike otherframeworks such as Struts or Hibernate.

Spring is a very powerful framework that solves many complex problems in enterprise

Java development. The most important feature of Spring framework can be MVC support which

is also provided by other frameworks but Spring’s MVC architecture is most widely accepted in

the industry. Almost all spring features are usable in a huge range of enterprise applications.

Spring supports development along with EJBs so that companies which have developed large

applications in EJBs can also adopt Spring with keeping their original source code. Spring

provides a reliable way of managing business objects and encourages good programming

practices. Spring promotes programming to interfaces rather than programming to classes. The

IoC container which is architectural basis for the Spring framework is designed to configure any

POJO thereby increasing reuse of the code. It has a very large community which continuously

improves the Spring source and provides technical supports and help to the developers. Currently

47% of Java shops uses Spring as a development framework, It is expected that 60-75% of the

companies will be using Spring by the end of year 2015. The current development of the Spring

makes the future scope for it very optimistic and it will make great competition to the other

component based framework like JSF (Java Server Faces).  

Page 24: Spring Doc Final

8/3/2019 Spring Doc Final

http://slidepdf.com/reader/full/spring-doc-final 24/24

 24 Spring Framework

7.  Bibliography

[1] http://en.wikipedia.org/wiki/Spring_Framework  

[2] http://static.springsource.org/spring/docs/2.5.x/reference/mvc.html  

[3] http://www.ibm.com/developerworks/web/library/wa-spring1/  

[4] http://www.roseindia.net/spring/springarchitecture.shtml  

[5] http://www.velocityreviews.com/forums/t389758-advantages-and-disadvantages-of-

using-the-spring-framework.html 

[6] http://www.cs.uofs.edu/~bi/2005f-html/se510/presentation-html/Spring_Framework-

1.html 

[7] http://www.cs.uofs.edu/~bi/2005f-html/se510/presentation-html/img26.html  

[8] http://www.javabeat.net/articles/spring/2/