For those of you who are fans of Spring, or those who are just plain curious, I'd like to briefly go over the parts of the framework we used in the latest release of Clearspace.  One of our goals for the new release was to take advantage of the power the framework offered where it made sense to us, and in the end it turned out Spring and Clearspace are a good fit for eachother.

 

Core Context and Struts: The JiveContext now extends the Spring ApplicationContext.  Everything registered with the context is a Spring bean.  Struts actions and interceptors are autowired using these bean definitions.  Writing Actions just got a whole lot simpler.

 

Data Access: We changed a lot of our code to use Spring's JdbcTemplate and SimpleJdbcTemplate.  This has the advantage of making our DAO code much simpler and less error prone, as well as quicker to write.  Some classes ended up half the size after this effort.  We used annotation-based transactions, wired in using Spring's AspectJ support via the AnnotationTransactionAspect.  This allowed us to quickly add transactional coverage of far more DAO methods than before, and more easily make methods transactional in future development.  Finally we used Spring's LDAPTemplate in several places to simplify directory access code.

 

Security: We're using Acegi (Spring Security) for authentication.  This allows the possibility to authenticate against more than one data store.  For example, you could have one account that authenticates against LDAP, and a separate machine account that authenticates against a database.  It also provides a well documented, peer-reviewed framework to use as a platform for developing custom authentication solutions.  We are investigating using Acegi more fully for authorization in future releases.

 

Tasks: We worked hard to externalize timed tasks so that they each have bean definitions.  This gives greater insight into what is being fired, why, and where.  It also makes it much easier to control when a task is firing, or turn it off completely for testing purposes.

 

Plugins: We allow plugins to add their own Spring bean definitions to the context, so that Plugin actions and interceptors can be autowired as expected.  This is done via the plugin's "spring.xml" file.

 

Web Services and AJAX: Apache CXF is now used to expose SOAP and REST style web services.  It relies heavily on Spring for its configuration.  We are also using Spring for DWR configuration, via the Spring 2.0 DWR namespace.

 

Customizations: As part of the new release we also parse any XML file in the <jive home>/etc directory with the expectation that it's a Spring configuration file.  Developers can use this to extend or override bean definitions in the core application context.

 

In the end, we found Spring very helpful to simplifying our codebase and providing a point of cohesion.  We look forward to using it even more fully as we continue to develop Clearspace, and as the Spring framework itself evolves.