Chapter 2. Introduction

2.1. Overview

Spring.NET is an application framework focused on helping build enterprise .NET applications. It provides a wide range of functionality such as Dependency Injection, Aspect Oriented Programming (AOP), data access abstractions, and ASP.NET integration. Based on the Spring Framework for Java, the core concepts and values found in Spring.Java have been applied to .NET.

Enterprise applications typically are composed of a number of a variety of physical tiers and within each tier functionality is often split into functional layers. The business service layer for example typically uses a objects in the data access layer to fulfill a use-case. No matter how your application is architected, at the end of the day there are a variety of objects that collaborate with one another to form the application proper. The objects in an application can thus be said to have dependencies between themselves.

The .NET platform provides a wealth of functionality for architecting and building applications, ranging all the way from the very basic building blocks of primitive types and classes (and the means to define new classes), to rich full-featured application servers and web frameworks. One area that is decidedly conspicuous by its absence is any means of taking the basic building blocks and composing them into a coherent whole; this area has typically been left to the purvey of the architects and developers tasked with building an application (or applications). Now to be fair, there are a number of design patterns devoted to the business of composing the various classes and object instances that makeup an all-singing, all-dancing application. Design patterns such as Factory, Abstract Factory, Builder, Decorator, and Service Locator (to name but a few) have widespread recognition and acceptance within the software development industry (presumably that is why these patterns have been formalized as patterns in the first place). This is all very well, but these patterns are just that: best practices given a name, typically together with a description of what the pattern does, where the pattern is typically best applied, the problems that the application of the pattern addresses, and so forth. Notice that the last paragraph used the phrase “... a description of what the pattern does...”; pattern books and wikis are typically listings of such formalized best practice that you can certainly take away, mull over, and then implement yourself in your application.

The IoC component of the Spring Framework addresses the enterprise concern of taking the classes, objects, and services that are to compose an application, by providing a formalized means of composing these various disparate components into a fully working application ready for use. The Spring Framework takes best practices that have been proven over the years in numerous applications and formalized as design patterns, and actually codifies these patterns as first class objects that you as an architect and developer can take away and integrate into your own application(s). This is a Very Good Thing Indeed as attested to by the numerous organizations and institutions that have used the Spring Framework to engineer robust, maintainable applications.

2.2. Background

In early 2004, Martin Fowler asked the readers of his site: when talking about Inversion of Control: “the question is, what aspect of control are [they] inverting?”. Fowler then suggested renaming the principle (or at least giving it a more self-explanatory name), and started to use the term Dependency Injection. His article then continued to explain the ideas underpinning the Inversion of Control (IoC) and Dependency Injection (DI) principle. If you need a decent insight into IoC and DI, please do refer to the article : http://martinfowler.com/articles/injection.html.

2.3. Modules

The Spring Framework contains a lot of features, which are well-organized into modules shown in the diagram below. The 1.0 release of Spring.NET contains a full featured Inversion of Control container and an AOP library. The 1.1 releases will contain Web, ORM and Data modules. Seperate modules not part of the standard Spring.NET download are dediated to integration with other libraries such a NHibernate, TIBCO EMS, Anthem, and IIOP.NET. The diagram below shows the various core modules of Spring.NET. The dark shaded modules are in the 1.0 release while the other modules are planned for future releases. In many cases you can already find working implementations for the planned modules available on our download site.

The Spring.Core library is the most fundamental part of the framework, and provides Dependency Injection functionality. Most of the libraries in the Spring.NET distribution depend upon and extend the functionality provided by this core library. The basic concept here is provided by the IObjectFactory interface that provides a simple yet elegant factory pattern removing the need for programmatic singletons and numerous service locator stubs, allowing you to decouple the configuration and specification of dependencies from your actual program logic. An extension to the IObjectFactory, the IApplicationContext is also located here and adds more enterprise-centric features such as text localization using resource files, event-propagation, and resource-loading.

The Spring.Aop library provides Aspect Oriented Programming (AOP) support to your business objects. The Spring.Aop library complements the IoC container in the Spring.Core library to provide a rock-solid foundation for building enterprise applications and applying services to business objects declaratively.

The Spring.Web library extends ASP.NET by adding a variety of features such as Dependency Injection for ASP.NET pages, Bidirectional data binding, Master pages for ASP.NET 1.1 and improved localization support.

The Spring.Services library let you expose any "normal" object (meaning an object that does not inherit from a special service base class) as an enterprise (COM+) service or remoting object. .NET Web services get additional configuration flexibility with support for depedency injection and overriding of attribute metadata. Windows Service intergration is also provided.

The Spring.Data library provides a Data Access Layer abstraction that can be used across a variety of data access providers, from ADO.NET to various ORM providers. It also contains an ADO.NET abstraction layer that removes the need for tedious coding and declarative transaction management for ADO.NET.

The Spring.ORM library provides integration layers for popular object relational mapping libraries. This provides functionality such as support for declarative transaction management

This document provides a reference guide to Spring.NET's features. Since this document is still very much a work-in-progress endeavour, if you have any requests or comments, please post them on the user forums at forum.springframework.net The latest version of this document can be found here

2.4. License Information

Spring.NET is licensed according to the terms of the Apache License, Version 2.0. The full text of this license are available online at http://www.apache.org/licenses/LICENSE-2.0 . You can also view the full text of the license in the license.txt file located in the root installation directory.

2.5. Support

Training and Support are available through Interface21 in addition to mailing lists and fourms you can find on the main Spring.NET website.