Friday, March 5, 2010

Spring EYE on JAVA EE - 1

EYE on JAVA EE: Spring’s Practical Example for Enterprise Application



Source Code with no library jars. Build works in Eclipse env. Require separate Tomcat Installation.



Spring, as a lightweight Java EE framework, offers a number of unique advantages, provides a one-stop-shop solution for all your programming needs from prototyping to full-scale production. The DI (Dependency Injection) feature significantly reduces the coupling among programming components, and promotes coding to interface concept in practice. POJO avoid all cumbersome platform dependent imports, greatly improves the testability. MVC offers clean separation among different roles, provide customizable binding and validation, while maintain the pluggability of other platform (like Struts). AOP makes declarative transaction management possible. Spring support of RMI, and JMS etc. makes distributed computing straightforward. All in all, Spring offers a complete support for most enterprise application development.


In this article, I will focus on a handful of most commonly used Spring features by developing a small electronic store application. It shows how different Spring components work and how easy to put them all work together.


First let’s go though the store specification. Since it is for demonstration purpose, the specification has been stripped down to the bare minimum.


The store sells exactly nine computer parts include computer, monitor, and SD cards. For each part, there is a threshold number, indicates the price adjustment if the order quantity is above this number. For example, for a computer – desktop PC, the regular price is $349. But when ordering more than five, the sixth one will be priced as $299. Multiple computer parts can be combined into one order.


In addition, the store offers two reports: one is how much total is sold within a certain period of time. The second one is how much total is sold for one particular computer part within a certain period of time.


The class diagram for the Order, OrderItem, Product, Report and Report Instance:




The UI for Add Product in Order Cart:




Make Order:




Request Report:




Browse Completed Reports:




Next

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home