Wednesday, March 19, 2008

Demonstrating Spring's Finesse

Spring IDE
using Spring IDE

______________
asr notes: what are the real real advantages spring as development platform ( my own view )
1. JDBCTemplates -- great to get sql result in one line
2. aspects for 'log messages' and security checks
3. INput FORM data validation declaratively , ability to define masks like for phone numbers etc.
4. ability to use caching ( JCS, hybernate ) built in interfaces provided
5. Good webflow module works with JSF , struts etc..
_______________________________

discard all below old stuff

Note: this is written in 2005 very old spring , probably get new Spring 2.0 application code
JpetStore -- app this author talks about
- download from here
- app demo

Author's note: In this excerpt from Chapter 8 of our book, Better, Faster, Lighter Java, we look at an example of an enterprise web application using the Spring framework. While Hibernate provided a single service, the Spring framework provides an efficient way to build and assemble Java applications, with abstractions for many services. Although it supports many services, Spring stays focused and clean with excellent layering and encapsulation. Like EJB, the centerpiece for Spring is a container, and like EJB, the Spring framework provides access to core J2EE services. But that's about as far as any similarities go. ( no more similarities with EJB ).

Pet Store: A Counter-Example
The J2EE Pet Store application is an infamous programming example gone bad. It taught thousands of J2EE developers to build poorly designed, poor-performing code. It was also the center of a benchmarking controversy

Data sources

A Java class that manages connections, usually in a pool.
DAO layers

If your applications use a database, you probably want to isolate the database access to one layer, the DAO. You can access this layer through the application context.
Persistence managers

Every persistence framework has an object or factory that the application uses to access its features. With Hibernate, it's the session and the session factory. With JDO, it's the persistence manager factory and persistence manager.
Transaction policies

You can explicitly declare the methods that you want to participate in transactions and the transaction manager that you want to use to enforce that strategy.
Transaction managers

There are many different transaction management strategies within J2EE. For single database applications, Spring lets you use the database's transaction management. For multiple databases or transaction sources, Spring allows JTA instead. You can keep the transaction manager in the application context.
Validation logic

The Spring framework uses a validation framework similar to Struts. Spring lets you configure validation logic like any other business component.
Views and controllers

The Spring framework lets you specify the controllers for a view and helps you configure the navigation path through them.

The jPetStore application uses the Spring application context for a data source, the DAO layer, and a transaction strategy. You define what goes into a context within an XML document that lists a series of beans

No comments: