What the Spring Framework has to offer?
- Not just another framework: Spring addresses areas that many popular frameworks don't. Spring provides a way to manage your business objects
- J2EE focused: Spring's main aim is to make J2EE easier to use. If EJB is what your company is looking for, then Spring is a very effective and lightweight alternative solution that can effectively organize your middle tier objects.
- Aspect Oriented Programming: Spring can eliminate the need to use a variety of custom properties file formats, by handling configuration in a consistent way throughout applications and projects
- Consistent framework: Spring provides a consistent framework for data access, whether using JDBC or an O/R mapping product such as Hibernate
- Portability and Application Server Support: Spring is portable between application servers. Of course ensuring portability is always a challenge, but we avoid anything platform-specific or non-standard, and support users on WebLogic, Tomcat, Resin, JBoss, WebSphere and other application servers.
Some important concepts used by Spring
- Inversion of Control (IoC) Container: The concept behind Inversion of Control is often expressed in the Hollywood Principle: "Don't call me, I'll call you." IoC moves the responsibility for making things happen into the framework, and away from application code. Where configuration is concerned this means that while in traditional container architectures such as EJB, a component might call the container to say "where's object X, which I need to do my work", with IoC the container figures out that the component needs an X object, and provides it to it at runtime. The container does this figuring out based on method signatures (such as JavaBean properties) and, possibly, configuration data such as XML.
- XMLBean Factory: Spring users normally configure their applications in XML "bean definition" files. Relationships between objects are normally set explicitly in configuration
Examples of Implementation
Project: A large Clearing House wants to provide its customers with a system to schedule reports with dynamic fields, in several formats (XML, SWIFT, FpML, etc). The system will have both a front-end and will be leveraged for system-to-system integration
Architecture: The architecture of the system supported Component based development
Framework: Spring Framework, Net UI Framework
O/R Mapping: Castor
Application Server: BEA Weblogic
The Spring Framework provided us with a base to easily build components.
Example:
Scheduling Component
This functionality of this component was to accept requests and schedule them for processing. Using the Spring Framework we managed to do the following:
- Spring took care of the lifecycle of all the objects in this component
- Spring provided us the ability to aspect the development of this component. That is by using the XML Bean concept we were able to specify in a property file whether the component was a singleton or not and pass values to final variables. In this way the code did not have anything "Spring" proprietary in it. Thereby giving us the flexibility of reusing the code with any other framework
- By creating a component we have made it reusable and can be used in any system with minimum effort
- Spring supported O/R mapping provided by Castor
- By using Spring Junit testing was much easier and faster to create
Sources
|