Summary


Spring is the most popular and comprehensive of the "lightweight" J2EE frameworks that have surged in popularity since 2003.

Spring enables you to streamline your J2EE development efforts, and bring a welcome consistency to application architecture and implementation. Spring will help you deal with the complexity of J2EE APIs, but is also equally at home outside a J2EE environment.

Important 

Spring is based on supporting an application programming model where code is written in POJOs.

Spring achieves this through use of two recently proven paradigms, both of which it has played an important role in popularizing:

  • Dependency Injection: An approach to configuration management in which an Inversion of Control container such as that provided by Spring configures application objects via JavaBean properties or constructor arguments. This removes the need for application code to implement framework interfaces, and allows the framework to add value in many areas — for example, supporting hot swapping of objects without affecting other objects that hold references to them.

  • AOP: AOP provides a way of providing services to POJOs without them needing to be aware of framework APIs, or be unduly constrained by framework requirements.

Spring supports its Dependency Injection and AOP capabilities by providing a consistent abstraction in a number of important areas, including:

  • Data access

  • Transaction management

  • Naming and lookup

  • Remoting

We saw how Spring is designed to promote architectural good practice. A typical Spring architecture will be based on programming to interfaces rather than classes, and will facilitate choice between best of breed solutions in areas such as O/R mapping and web framework, within a consistent architecture. It ensures that architectural layers are coupled through well-defined interfaces.

Spring is also designed to facilitate best practice in development process. In particular, applications using Spring are normally easy to unit test, without the need to deploy code to an application server to conduct all tests.

Important 

There is some confusion about whether Spring competes with J2EE. It does not. J2EE is most successful as a set of specifications for low-level services; Spring is essentially an enabler of an application programming model.

Spring does compete with many services provided by EJB, but it's important to avoid the mistake of confusing EJB with J2EE. EJB is a component model that enters the application programming domain; J2EE is a platform that deals more with consistent provision of low-level services. Spring in fact allows you to use J2EE more effectively. It allows you to dispense with EJB, and the complexity it entails, in many cases, while providing support for implementing and accessing EJBs in case you do choose to use them.

In reality, Spring competes far more with in-house frameworks. As we saw at the beginning of this chapter, trying to develop applications with J2EE out of the box is cumbersome and unwise. For this reason, many companies develop their own proprietary frameworks to simplify the programming model and conceal the complexity of J2EE APIs. Spring provides a far better option, with a powerful, consistent approach that has been tested by tens of thousands of users in thousands of applications.

In the remainder of this book, we'll look in detail at how Spring realizes the vision we've described in this chapter.



Professional Java Development with the Spring Framework
Professional Java Development with the Spring Framework
ISBN: 0764574833
EAN: 2147483647
Year: 2003
Pages: 188

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net