Friday, April 15, 2005

Season of Spring

Going by the amount of open source projects I have recently seen rallying around Spring, it seems to have largely overshadowed EJB 3.0. JBoss 4.0 provides a plugin for EJB 3.0 and Oracle has also released a preview of Oracle Application Server EJB 3.0. But the EJB needs a major overhaul to address the growing realization that EJBs are not the key to a scalable and high performance architecture. Here is an excellent critique of EJB 3.0. Spring container can be plugged with all the components required for building scalable web applications.

You get to choose a whole lot of MVC frameworks in Spring. By using the dependency injection, Spring allows the web application context to be automatically supplied with business delegates instead of having to look them up. Spring has its own MVC component, can inject Struts actions with beans through Struts with Spring, and can also Webwork2 actions. There is a two way integration with JSF (Java Server Faces), that makes Spring beans available to JSF beans and integrates JSF beans into Spring.

View technologies - Because views in Spring are completely seperated from MVC layer, it is possible to use XSLT, JasperReports and Tiles as view components, apart from velocity and JSP. See here for pointers on integrating Cocoon as view.

Persistence - Spring can use Hibernate, iBATIS and JDO as its persistence mechanism and provides a common API for exception wrapping, transactions and resource management.

Security - Acegi framework also has ACL-based security apart from role-based security. Role-based security in J2EE containers frequently proves insufficient and has to be enhanced programmatically by using adhoc solutions. Using Yale University's open source Central Authentication Service (CAS), the Acegi Security System for Spring can participate in an enterprise-wide single sign on environment.

To get started, you can use Appfuse, which is a fully integrated template application with many frameworks to jumpstart your development. It provides templates for various combinations of hibernate, tapestry, jsf and can even generate simple forms using appgen. Going by the amount of effort that has gone into the development of web application frameworks in Java, I am always frustrated by the amount of work required to develop even simple applications and Appfuse is really refreshing.