Archive

Posts Tagged ‘spring features’

Spring Framework Primer

November 20, 2009 Leave a comment

 

 

 

  

  

Spring Framework Primer 

The Spring Framework is an open source application framework, for the Java platform and also the .NET Framework (Spring.NET). The first version was written by Rod Johnson who released the framework with the publication of 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 Spring 1.2.6 framework won a Jolt productivity award and a JAX Innovation Award in 2006. The current Spring framework version is 3.0.

VMware acquired SpringSource for approximately $362 million on September 16, 2009.

Spring was 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 or modules you want to use for your application development. Unlike single-tier frameworks, such as Struts or Hibernate, Spring aims to help structure whole applications in a consistent, productive manner, pulling together best-of-breed single-tier frameworks to create a coherent architecture.

The core features of the Spring Framework can be used by any Java application, but there are extensions for building web applications on top of the Java Enterprise platform. Although the Spring Framework does not impose any specific programming model, it has become popular in the Java community as an alternative, replacement, or even addition to the Enterprise JavaBean (EJB) model.

 

Spring is unique for several reasons:

  • It addresses important areas that other popular frameworks don’t. Spring focuses around providing a way to manage your business objects.
  • Spring is comprehensive and modular (because of its modules). Spring has a layered architecture, meaning that you can choose to use just about any part of it in isolation, yet its architecture is internally consistent. So you get maximum value from your learning curve. For example: You might choose to use Spring only to simplify use of JDBC, or you might choose to use Spring to manage all your business objects. 
  • It’s easy to introduce Spring incrementally into existing projects.
  • Spring is designed from the ground up to help you write code that’s easy to test. Spring is an ideal framework for test driven projects.
  • Spring is an increasingly important integration technology, its role is recognized by vendors both large and small.
  • Spring also addresses most infrastructure concerns (cross-cutting concerns such as logging, security etc) of typical applications.

 

  

Architectural benefits of Spring:

Let’s look at some of the benefits Spring can bring to your project:

  • Spring can effectively organize your middle tier objects. Spring takes care of plumbing that would be left up to you if you use only Struts or any other framework that use J2EE APIs.
  • Spring’s configuration management services can be used in any architectural layer, in whatever runtime environment.
  • Spring can eliminate the increase of Singletons used in many projects. This is a major problem that reduces testability and object orientation.
  • Spring eliminates the need to use a variety of custom properties file formats, by handling configuration in a consistent way throughout the application.
  • Spring facilitates good programming practice by reducing the cost of programming to interfaces rather than classes.
  • Spring is designed so that applications built with it depend on as few of its APIs as possible. Most business objects in Spring applications have no dependency on Spring.
  • Applications built using Spring are very easy to test. For certain unit testing scenarios, the Spring Framework provides mock objects and testing support classes. Spring also provides unique “integration testing” functionality in the form of the Spring TestContext Framework and legacy JUnit 3.8 support classes that enable you to test your code quickly and easily, even while accessing a staging database.
  • Spring helps you solve problems though being a most lightweight possible infrastructure. Spring provides an alternative to EJB that’s appropriate for many applications. For example, Spring can use AOP to deliver declarative transaction management without using an EJB container; even without a JTA implementation.
  • Spring provides a consistent framework for data access, whether using JDBC or an O/R mapping product such as TopLink, Hibernate or a JPA or JDO implementation.

 

Spring is essentially a technology dedicated to enable building applications using Plain Old Java Objects (POJOs). It enables you to develop components as POJOs containing only your business logic, while the framework takes care of the many value adds you need while building enterprise applications — even in areas that you may not have considered when initially authoring the application. This goal requires a sophisticated framework, which conceals much complexity from the developer.

Since your business logic is abstracted from infrastructure concerns, it’s also likely to enjoy a longer life. As the business logic is abstracted from the infrastructure concerns, any changes to the inevitable infrastructure change (such as choice of application server) can be minimized. Thus Spring can enable you to implement the simplest possible solution to your problems. And that’s worth a lot.

 

What does Spring do?  Read more…

Advertisements

Spring Framework Introduction

November 20, 2009 Leave a comment

 

Chapter 2: Introduction to Spring

 

Spring Framework:

The Spring framework is a comprehensive layered Java/Java EE application platform. It was created to address the complexity of enterprise application development. The Spring Framework takes best practices and design patterns that have been proven over the years, codifies these patterns as first class objects that can be integrated into applications. Spring makes it possible to use plain-vanilla Java Beans (POJOs) to achieve things that were previously only possible with EJBs.

 

Spring includes:

  • An IOC lightweight container
  • AOP functionality
  • Abstraction layer for JDBC / transaction management                    
  • ORM integration layer
  • Web integration layer
  • A flexible MVC web application framework 

 

Spring is not only an application framework, it also serves as a platform for several open source projects that are based on the core Spring Framework project such as Spring IDE, Spring Security, Spring Web Flow, Spring Web Services, Spring Rich Client,  Spring Batch, Spring Modules, Spring Dynamic Modules, Spring Integration, Spring LDAP, Spring JavaConfig, Spring .NET, Spring BeanDoc.

 

Spring’s features:

Framework:

Spring makes it possible to develop and maintain complex applications using simple components. In Spring, application objects are configured declaratively typically in an XML file. Spring also provides much infrastructure functionality (transaction management, integration, etc.), leaving only the development of application logic to you.

 

Lightweight:

Spring is lightweight in terms of both size and overhead. Spring Framework can be distributed in a single JAR file that weighs just over 2.5 MB and the processing overhead required by Spring is negligible. Spring is non intrusive in a way that the objects in a Spring-enabled application often have no dependencies on Spring-specific classes.

 

Container:

Spring provides a container which contains and manages the lifecycle and configuration of application objects. In Spring, you can declare how each of application objects should be created, how they should be configured, and how they should be associated with each other.

 

Dependency Injection:

Spring promotes loose coupling through dependency injection (DI). When DI is applied, objects are passively given their dependencies instead of looking for dependencies themselves. You can think of DI as JNDI in reverse — instead of an object looking up for dependencies from a container, the container gives the dependencies to the object at its instantiation without waiting to be asked.

 

Aspect-oriented:

Spring comes with rich support for aspect-oriented programming (AOP) that enables separating application business logic from system services (such as auditing, transaction management, logging etc). Application objects do what they’re supposed to do i.e., perform business logic — and nothing more. They are not responsible for or even be aware of other system concerns, such as logging or transactional support.

 

Spring Framework Architecture: Read more…