Magazine
 
Spring
 

Spring Framework

The Spring Framework comes in the form of ZIP file
with the necessary jars, examples etc. The Spring
framework can be downloaded from http://
www.springframework.org.
There will be two zip files
one with dependencies and other without. The spring
framework with dependencies is larger and includes all
dependent libraries. Download Spring framework 1.2.9
without dependency and unzip on the hard disk as
spring1.2.9.


Inside the folder spring1.2.9 there are 7 folders. The names
and the contents of all the folders are given below:

1 dist: It contains various Spring distribution jar files.
2 docs: It contains general documentation and API
javadocs.
3 mock:
It contains mock JNDI contexts and a set of
servlet API mock objects.
4 samples: It contains demo applications and skeletons.
5 src: It contains the Java source files for the framework.
6 test: It contains the Java source files for Spring’s test
suite.
7 tiger: It contains JDK1.5 examples and test suite.

Inside the “dist” directory, we can find all the jar files
necessary for compiling and executing the program. The
jar files and its contents are listed below:

1 spring.jar: It contains the entire spring framework
including everything in the other JAR files also.
2 spring-core.jar: It contains the core spring container
and its utilities.
3 spring-beans.jar: It contains the bean spring container
and JavaBeans support utilities.
4 spring-aop.jar: It contains spring’s AOP framework,
source-level metadata support, AOP Alliance interfaces
etc.,
5 spring-context.jar: It contains application context,
validation framework, JNDI, templating support and
scheduling.
6 spring-dao.jar: It contains DAO support and transaction
infrastructure.
7 spring-jdbc.jar: It contains the JDBC support. spring-support.jar: It contains JMX support, JCA support, scheduling support, mail support and caching support.
8 spring-web.jar: It contains the web application context, multipart resolver, Struts support, JSF support and web utilities.
9 spring-webmvc.jar: It contains the framework servlets, web MVC framework, web controllers and web views.
10 spring-remoting.jar: It contains remoting support,
EJB support and JMS support.

  11 spring-orm.jar: It contains iBATIS SQL Maps support,
Apache OJB support, TopLink support and JDO support
12 spring-orm.jar: It contains iBATIS SQL Maps support,
Apache OJB support, TopLink support and JDO support.
13 spring-hibernate.jar: It contains Hibernate 2.1 support, Hibernate 3.x support.
14 spring-mock.jar: It contains JNDI mocks, Servlet API
mocks and JUnit support.

org.springframework.beans package

The core of spring is the org.springframework.beans package, designed for working with JavaBeans. This package is not used directly by users, but provides much of the spring functionality.
The next higher layer of abstraction is the bean factory. A spring bean factory is a generic factory that enables objects to be retrieved by name, and which can manage relationships between objects.

Bean factories support two modes of object:

• Singleton: In this case, there’s one shared instance of
the object with a particular name, which will be retrieved
on lookup. This is the default, and most often used, mode. It’s ideal for the stateless service objects.

• Prototype or non-singleton: In this case, each
retrieval will result in the creation of an independent
object. For example, this could be used to allow each
caller to have its own distinct object reference.

The Spring container manages relationships between objects, so it can add value (where necessary) through services such as transparent pooling for managed POJOs, and support for hot swapping, where the container introduces a level of indirection that allows the target of a reference to be swapped at runtime without affecting callers and without loss of thread safety.

As org.springframework.beans.factory.BeanFactory is a simple interface, it can be implemented in different ways. The BeanDefinitionReader interface separates the metadata format from BeanFactory implementations themselves, so the generic BeanFactory implementations that spring provides can be used with different types of metadata. It is easy to implement your own BeanFactory or BeanDefinitionReader.

The most commonly used BeanFactory definitions are:

XmlBeanFactory: This parses a simple, intuitive XML structure defining the classes and properties of named objects. We provide a DTD to make authoring easier.

DefaultListableBeanFactory:
This provides the ability to
August 2007 | Java Jazz Up | 22
 
previous
index
next
 
Pages: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
31, 32, 33, 34, 35, 36, 37, 38, 39, 40           Download PDF