-- Spring Framework --




-> backGround
- Spring is an open-source framework, created by Rod Johnson and described in his book
Expert One-on-One: J2EE Design and Development.
- Spring is a lightweight inversion of control and aspect-oriented container framework.

-> Spring is a development style like J2EE EJB.But solve some limitations of EJB

-> problem: in EJB, has to write several classes to make a component. such as the home
interface,the local interface,and the bean itself.
in addition has to create a deployment descriptor for the bean.

-> solution: incorporates XDoclet
XDoclet is a code generation tool that can generate all of the necessary EJB files
from a single source file.

-> Problem: when testing, have to fire up the container in each test and each change of
the code. It is a waisting time, the development lifecycle will add a "waitting" phase.
(code -> wait -> test).

-> solution: using light waight container without any unnessasory things.
Because in J2EE containers have all transaction managment + remoting or security-
services + persistence services.
coz enterprise projects do not have this level of complexity at all.


-> With EJB, application complexity is high, regardless of the complexity of the problem.
Even simple applications are unduly complex. With Spring, the complexity of application
is proportional to the complexity of the problem being solved.

-> Spring was designed with following beliefs.

* Good design is more important than the underlying technology.

-> spring reduse the complexity,and remove unnessasory functinalities.(ie- If an
application does not require distribution or declarative transaction support).
and easy to work with POJO instaed of EJBs. And you don't need an EJB container,
and don't have to implement special interfaces. You just have to write your code.

* JavaBeans loosely coupled through interfaces is a good model.

-> EJBs are used to provide application services, but they not just depend on the
EJB business interface. They are also responsible for retrieving these EJB
objects from a directory- Java Naming and Directory Interface (JNDI) lookup and
communicating with the bean's EJBHome interface. This is not decoupling a
application.
With Spring, your beans depend on collaborators through interfaces. Since
there are no implementation-specific dependencies, Spring applications are very
decoupled, testable, and easier to maintain. And because the Spring container
is responsible for resolving the dependencies, the active service lookup that
is involved in EJB is now out of the picture and the cost of programming to
interfaces is minimized. All you need to do is create classes that communicate
with each other through interfaces, and Spring takes care of the rest.

* Code should be easy to test.

-> Spring applications with JavaBeans, testing is cheap (coz testing is on POJO).
therefore no beed a container. since Spring makes coding to interfaces easy,
your objects will be loosely coupled, making testing even easier.


-> charecteristics of Spring?

* Lightweight—
- The entire Spring framework can be distributed in a single JAR file(just over 1 MB).
- And the processing overhead required by Spring is negligible.
- Spring is nonintrusive:
objects in a Spring-enabls no dependencies on Spring-specific classes.

* Inversion of control—
- Spring promotes loose coupling through a technique.(ie-inversion of control (IoC)).
When IoC is applied, objects are passively given their dependencies instead of
creating or looking for dependent objects for themselves.
( 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—
- AOP enables cohesive development by separating busines logic from system services
(ie. auditing and transaction management).separate system functions from the objects.

* Container—
- Spring is a container in the sense that it contains and manages the life cycle
and configuration of application objects.

* 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.).

-> Spring modules(made up of 7 modules)



-> The core container
- provides the fundamental functionality of
the Spring framework.(Spring's BeanFactory)
- A BeanFactory is an implementation of the
factory pattern that applies IoC to
separate your application's configuration
and dependency specifications from the
actual application code.

-> Application context module
- make a framework 4 Spring.
- This module extends the concept of "BeanFactory", adding support for
internationalization (I18N) messages, application life cycle events, and validation.
- and supplies many enterprise services such as e-mail, JNDI access, EJB integration,
remoting, and scheduling.
- and also supports templating frameworks such as Velocity and FreeMarker.

-> Spring's AOP module
- used to develop aspects for Spring-enabled application.
- able to work with AOP Alliance(The AOP Alliance is an open-source project)
- also introduces metadata programming to Spring.
(metadata support - add annotations and instruct Spring on where and how to
apply aspects).

-> JDBC abstraction and the DAO module
- pring's JDBC and Data Access Objects (DAO) module abstracts away the boilerplate code
to keep your database code clean and simple.

-> Object/relational mapping integration module
- provide hooks into several popular ORM frameworks such as Hibernate, JDO,
and iBATIS SQL Maps.

-> Spring's web module
- this builds on the application context module, providing a context that is
appropriate for web-based applications.
- and provide web-oriented tasks such as transparently handling multipart requests for
file uploads and programmatic binding of request parameters to your business objects.

-> The Spring MVC framework
-> Spring comes with a full-featured Model/View/Controller (MVC) framework.

Comments

Popular posts from this blog

-- Are you a Android Developer? --

-- Google Android --

What is serialVersionUID?