[image]
Few pages of this site are under construction and we are constantly trying to improve it. If you have any suggestions or ideas about how to improve the site, please let us know.
Code Quick View
HelloServiceImpl.java
 package com.developersBook.springExample.serviceImpl;

import com.developersBook.springExample.domain.Name;
import com.developersBook.springExample.service.HelloService;
 
public class HelloServiceImpl implements HelloService {

 public String sayHello(Name name) {

  return "Hello  " + name.getFirstName() + " " + name.getLastName();
        }

}

Code Quick View
ByeServiceImpl.java
 package com.developersBook.springExample.serviceImpl;

import com.developersBook.springExample.domain.Name;
import com.developersBook.springExample.service.ByeService;

public class ByeServiceImpl implements ByeService {

 public String sayBye(Name name) {
        return "Bye " + name.getFirstName() + " " + name.getLastName();
        }

}

Articles Quick View Articles
Bookshelf Quick View
Book Shelf
Certifications Quick View
Professional Certifications
Your Name:

Your Email:

Feedback:
Confirmation Code:
[image]
Enter code:

Spring Framework Modules
Forum Quick View
Technical Discussions
Interview FAQs Quick View
Interview Questions
Tutorials Quick View Tutorials
Login
Register
Ask a question
Home Home
Articles Articles
Tutorials Spring Tutorials iBatis Tutorials JSF-MyFaces Tag Ref. JSF Tutorials Hibernate Tutorials Struts Tutorials More....
Interview Questions
Spring Questions JSF Questions Hibernate Questions Struts Questions AJAX Questions JSP Questions Servlets Questions JDBC Questions Core Java Questions XML Questions Webservices Questions EJB Questions webMethods Questions Tibco Questions BREW Questions More....
Certifications Spring Certification SCJP 6.0 SCJP 5.0 SCJP 1.4 SCWCD SCBCD SCEA SCMAD SCDJWS J2EE WebSphere XML PMP UML webMethods Struts More....
Spring Framework Tutorials
« Previous | 1 2 |Next »

The Spring framework overview:

Spring is the de-facto standard in lightweight enterprise application framework. Spring is an open source framework created to address the complexity of enterprise application development. One of the main advantages of the Spring framework is its layered architecture, which allows you to be selective about which of its components you use while also providing a consistent framework for J2EE application development.

However Spring’s usefulness isn’t limited to server-side development. Any Java application can benefit from Spring in terms of simplicity, testability, and loose coupling.


Spring framwork modules:

The Spring framework is a layered architecture consisting of seven well-defined modules. The Spring modules are built on top of the core container, which defines how beans are created, configured, and managed, as shown in following figure.

Each of the modules or components that consist of the Spring framework can stand on its own or be implemented jointly with one or more of the other modules or components. The description of each component is as follows:

The core container:

The core container provides the fundamental functionality of the Spring framework. In this module primary component is the BeanFactory, an implementation of the Factory pattern. The BeanFactory applies the Inversion of Control (IOC) pattern to separate an application's configuration and dependency specification from the actual application code.

Spring context module :

TThe Spring context is a configuration file that provides context information to the Spring framework. The Spring context includes enterprise services such as e-mail, JNDI, EJB, internalization, validation, scheduling and applications lifecycle events. Also included is support for the integration with templating frameworks such as velocity.

Spring AOP module:

The Spring AOP module allows a software component to be decorated with additional behavior, through its configuration management feature. As a result you can easily AOP-enable any object managed by the Spring framework. The Spring AOP module provides transaction management services for objects in any Spring-based application. With Spring AOP you can incorporate declarative transaction management into your applications without relying on EJB components.

Spring DAO module:

The Spring DAO module provides a JDBC-abstraction layer that reduces the need to do tedious JDBC coding and parsing of database-vendor specific error codes. Also, the JDBC package provides a way to do programmatic as well as declarative transaction management, not only for classes implementing special interfaces, but for all your POJOs (plain old Java objects).

Spring ORM module:

: Spring provides integration with OR mapping tools like Hibernate, JDO and iBATIS. Spring transaction management supports each of these ORM frameworks as well as JDBC.

Spring Web module:

The Web context module provides basic web-oriented integration features 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.

Spring MVC framework module:

Spring provides a pluggable MVC architecture. The users have a choice to use the web framework or continue to use their existing web framework. Spring separates the roles of the controller; the model object, the dispatcher and the handler object which makes it easier to customize them. Spring web framework is view agnostic and does not push the user to use only JSPs for the view. The user has the flexibility to use JSPs, XSLT, velocity templates etc to provide the view.

Back to top

Inversion of Control (Dependency Injection):

Inversion of control is at the heart of the Spring framework. The basic concept of the Inversion of Control pattern (also known as dependency injection) is that you do not create your objects but describe how they should be created. You don't directly connect your components and services together in code but describe which services are needed by which components in a configuration file. A container (in the case of the Spring framework, the IOC container) is then responsible for hooking it all up.

The easiest way to understand inversion of control is to see it in example. This basic Spring example demonstrates how you can inject application dependencies through the Spring IOC container.


Inversion of Control Example:

It is a simple code for wishing hello and bye. We have two interfaces HelloInterface and ByeInterface as listed below:

Code Listing 1. HelloService Interface   (See Implementation)

 
package com.developersBook.springExample.service;

import com.developersBook.springExample.domain.Name;

public interface HelloService {
        public String sayHello(Name name);
}

Code Listing 2. ByeService Interface   (See Implementation)

 
package com.developersBook.springExample.service;

import com.developersBook.springExample.domain.Name;

public interface ByeService {
        public String sayBye(Name name);
}


Back to top

« Previous | 1 2 |Next »
Copyright © 2008 developersBOOK.COM. All rights reserved.


You are viewing a mobilized version of this site...
View original page here

How do you rate mobile version of this page?

Mobilized by Mowser Mowser