Custom Search
Tuesday, November 27, 2007
What Is Spring?
In the world of technology so may frame-works are coming and it’s a big question in front of us that which one is better.To solve this query I tried explaining frame-work in short. So, let’s start with Spring frame-work

Spring is an open-source framework, and to Put simply, Spring is a
lightweight inversion of control and aspect-oriented container
framework.
Okay, that’s not so simple a description. But it does summarize
what Spring does. To make more sense of Spring, let’s break this description down:


Lightweight—Spring is lightweight in terms of both size and overhead.
The entire Spring framework can be distributed in a single JAR file that
weighs in at just over 1 MB. And the processing overhead required by
Spring is negligible. What’s more, Spring is nonintrusive: objects in a
Spring-enabled application typically have no dependencies on Springspecific
classes.

Inversion of control—Spring promotes loose coupling through a technique
known as inversion of control (IoC). When IoC is applied, objects are passively
given their dependencies instead of creating or looking for dependent
objects for themselves. You can think of IoC as JNDI in reverse—
instead of an object looking up dependencies from a container, the container
gives the dependencies to the object at instantiation without waiting
to be asked.

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

Container—Spring is a container in the sense that it contains and manages
the life cycle and configuration of application objects. You can configure
how your each of your beans should be created—either create one single
instance of your bean or produce a new instance every time one is needed
based on a configurable prototype—and how they should be associated
with each other. Spring should not, however, be confused with traditionally
heavyweight EJB containers, which are often large and cumbersome
to work with.

Framework—Spring makes it possible to configure and compose complex
applications from simpler components. In Spring, application objects are
composed declaratively, typically in an XML file. Spring also provides
much infrastructure functionality (transaction management, persistence
framework integration, etc.), leaving the development of application logic
to you.


All of these attributes of Spring enable you to write code that is cleaner, more
manageable, and easier to test. They also set the stage for a variety of subframeworks
within the greater Spring framework.
Tuesday, November 20, 2007
Features of Spring Framework:
1 An Inversion of Control (IoC) container (Spring Core package) that supports Dependency Injection, a powerful technique pioneered by Spring for configuring POJO-based applications. Spring is the most popular and powerful of a number of frameworks in the IoC space.

2 A pure Java AOP (Aspect-Oriented Programming) framework (the Spring AOP package) that enables crosscutting functionality to be applied to POJOs, which enables sophisticated support for declarative transaction management in a range of environments.

3 A flexible web MVC framework. Spring also integrates out-of-the-box with popular web tier solutions such as Struts, WebWork, Tapestry, or JSF.

4 A common approach to persistence (the Spring DAO package).

5 Support for remoting, working with EJBs, JMS, and other important enterprise functionality (Spring Context package).

6 Integration with numerous third-party products, including the Quartz scheduler and Velocity template engine.
Sunday, November 18, 2007
Why Spring?
1 The "Struts" framework is no doubt a good framework to enhance the ability of the web tier, but the biggest drawback is the fact that it caters only to the web tier and leaves most of the Enterprise tier or middle tier to the fancy of the application architects.

2 The Application architects need to provide an additional framework to deal with the enterprise tier and make sure that the new framework integrates well with the Struts framework.

3 Spring tries to alleviate this problem by providing a comprehensive framework, which includes an MVC framework, an AOP integration framework, a JDBC integration framework, and an EJB integration framework.

4 It also provides integration modules for major O/R mapping tools like Hibernate and JDO. Spring provides all these in a modular fashion without imposing any layer on to the user.

5 Spring is not a take-it-or- leave-it kind of framework. It tries to seamlessly blend into the existing framework users have without hindrances.

6 Spring also provides transaction management support using Java classes, email support packages using framework classes, web services support through proxies and many more features like the above.

7 As mentioned earlier all these packages are optional and spring does not make any of them mandatory. Spring can seamlessly integrate with existing applications and provide specific functionality that you intend to provide with minimal demands for customization.

8 A user can continue to use Struts for the web tier and top link O/R for the database and meanwhile hook spring to provide e-mail services and web services support. Spring is based on the Inversion of Control/Dependency Injection pattern that has been making rounds in message boards all over the Internet.
Saturday, November 17, 2007
Architectural benefits of Spring
Before we get down to specifics, let's look at some of the benefits Spring can bring to a project:

1 Spring can effectively organize your middle tier objects, whether or not you choose to use EJB. Spring takes care of plumbing that would be left up to you if you use only Struts or other frameworks geared to particular J2EE APIs. And while it is perhaps most valuable in the middle tier, Spring's configuration management services can be used in any architectural layer, in whatever runtime environment.

2 Spring can eliminate the proliferation of Singletons seen on many projects. In my experience, this is a major problem, reducing testability and object orientation.

3 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. Ever wondered what magic property keys or system properties a particular class looks for, and had to read the Javadoc or even source code? With Spring you simply look at the class's JavaBean properties or constructor arguments. The use of Inversion of Control and Dependency Injection (discussed below) helps achieve this simplification.

4 Spring can facilitate good programming practice by reducing the cost of programming to interfaces, rather than classes, almost to zero.

5 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.

6 Applications built using Spring are very easy to unit test.

7 Spring can make the use of EJB an implementation choice, rather than the determinant of application architecture. You can choose to implement business interfaces as POJOs or local EJBs without affecting calling code.

8 Spring helps you solve many problems without using EJB. Spring can provide 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, if you only need to work with a single database.

9 Spring provides a consistent framework for data access, whether using JDBC or an O/R mapping product such as TopLink, Hibernate or a JDO implementation.

10 Spring provides a consistent, simple programming model in many areas, making it an ideal architectural "glue." You can see this consistency in the Spring approach to JDBC, JMS, JavaMail, JNDI and many other important APIs.