close

Spring framework

ArticlesSpring framework

Spring Series Tutorial

no thumb

Spring is an open source framework created to address the complexity of enterprise application development.

Start to build lightweight, robust J2EE applications using Spring technology with the following Spring series articles. The Spring series articles was rated as the best article and has the highest visits and ratings of all time , in last 10 years (2000-2010) of IBM devloperWorks. Thanks to all the readers. I will be updating the Spring series with the latest release, for now enjoy the articles.

To get started on Spring 2 framework, View my book Beginning Spring Framework 2

read more
ArticlesMQSeriesSpring framework

Spring Series Tutorial – Spring JMS

image07

In this fourth and final installment of the Spring Series , I introduce you to features of the Spring JMS (Java Message Service) framework. JMS defines a standard way for Java applications to create and exchange messages through a Message Oriented Middleware (MOM).

As in the previous articles of this series, I use a simple example to demonstrate the features of Spring JMS. You’ll follow along as I develop a point to point (P2P) message-based system, using the Spring JMS framework to integrate with IBM’s WebSphere MQ through a JMS Interface. Upon completing the exercise, you’ll be able to send and receive simple text messages through the system.

Download the article source before you begin. The examples was tested on IBM WebSphere MQ 5.3. You will also need Apache Ant to run the example application.

Spring JMS

Spring’s JMS abstraction framework simplifies the use of JMS APIs and smoothly integrates with JMS providers such as IBM’s WebSphere MQ 5.3. The package org.springframework.jms.core provides the core functionality for using JMS in Spring. Its template classes simplify the use of the JMS by handling the creation and release of resources.

Like most other Spring template classes, the JMS template classes provide helper methods that perform common operations. In cases that require more sophisticated usage, the classes delegate the essence of the processing task to user-implemented callback interfaces. The JMS classes offer convenience methods for sending a message, consuming a message synchronously, and exposing a JMS session and message producer to the user.

read more
ArticlesSpring framework

Spring Series Tutorial – Swing into Spring MVC

image1

In this third installment of the Spring Series, I introduce you to the Spring Model-View-Controller (MVC) framework. As in the previous articles, I use a banking example to show you how to model and build a simple application. The example application will encompass some of the techniques you’ve already learned — such as dependency injection — but will primarily demonstrate features of Spring MVC.

Download the article source before you begin.

The Spring MVC framework

The Spring framework provides a full-featured MVC module for building Web applications. With Spring’s pluggable MVC architecture, you can choose whether you want to use the built-in Spring Web framework or a Web framework such as Struts. The framework is highly configurable through strategy interfaces and accommodates multiple view technologies such as JavaServer Pages (JSP) technology, Velocity, Tiles, iText, and POI. The Spring MVC framework is view agnostic, so does not push you to use only JSP technology. Spring MVC separates the roles of the controller, the model object, the dispatcher, and the handler object, which makes them easier to customize.

Spring’s Web MVC framework is designed around a DispatcherServlet that dispatches requests to handlers, with configurable handler mappings, view resolution, locale, and theme resolution as well as support for upload files. The default handler is a very simple Controller interface with just one method, ModelAndView handleRequest(request, response). Spring provides a controller hierarchy that can be subclassed. If your application needs to process user entry forms you might subclass AbstractFormController. If you need to process a multi-page entry into a single form you can subclass AbstractWizardFormController.

read more
ArticlesSpring framework

Spring Series Tutorial – When Hibernate meets Spring

bk6

In the previous installment of this series, I introduced the seven modules of the Spring framework, including Spring AOP and the inversion of control (IOC) container. I then used a simple example to show you how the IOC pattern (as implemented by the Spring IOC container) works to integrate disparate systems in a loosely coupled manner.

Now, I pick up where I left off and, with an example similar to the one you encountered last time, demonstrate Spring’s persistence support. Because this banking example incorporates the declarative transaction handling of Spring AOP and the persistence backbone of Spring Hibernate, I’ll start with a closer look at each of these technologies.

Download the article source.

Spring AOP

Software systems are typically composed of several components, each responsible for a specific area of functionality. Often, however, these components carry additional responsibility beyond their core functionality. System services such as logging, transaction management, and security frequently find their way into components whose core responsibility is something else. The result is sometimes known as code tangling, or more simply, “a mess.” Aspect-oriented programming is a programming technique that seeks to resolve this problem by promoting separation of concerns as a core programming concept.

With AOP, you still define a system’s common functionality in one place, but you can declaratively define how and where to apply this functionality. If you modularize crosscutting concerns, such as logging and transaction management, it becomes possible to add new features to your code without modifying each class individually. Such modularized concerns are known as aspects.

Did you know?

You can use Spring framework functionality in any Javaâ„¢ Enterprise Edition (JEE) server. Also, you can adapt most of it to non-managed environments. A central focus of Spring is to allow for reusable business and data-access objects that are not tied to specific JEE services. You can reuse such objects across JEE environments (Web or Enterprise JavaBeans(EJB)), standalone applications, test environments, and so on, without any hassle.

read more
ArticlesSpring framework

Spring Series Tutorial – Introduction to Spring framework

spring30-framework

Spring is an open source framework created to address the complexity of enterprise application development. One of the chief 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 cohesive framework for J2EE application development.

In this first article in my four-part Spring Series, I introduce you to the Spring framework. I start by describing the functionality of the framework in terms of its underlying modules and then discuss two of the most interesting modules, Spring aspect-oriented programming (AOP), and the Inversion of Control (IOC) container. I then use several examples to demonstrate the workings of the IOC container in a typical application use case scenario. The examples will also lay the foundation for an expanded discussion, later in this series, of the how the Spring framework implements AOP constructs through Spring AOP.

The Spring framework

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 Figure 1.
Figure 1. The seven modules of the Spring framework
spring_framework

read more
1 2
Page 2 of 2