ColdSpring 2 Alpha 1 Released

After a long 2 years of development, ColdSpring 2, Alpha 1 is ready for release!

It’s been a long road getting here, but with the rewrite of ColdSpring, means that ColdSpring 2 comes with a stack of new functionality that should help you out with all your dependency injection needs, and then some!!!

To give you a quick overview of some of the major new functionality that comes with ColdSpring 2:

XML Schema For ColdSpring

No more needing to guess what XML to write with ColdSpring, or use a not-quite-right-fit Spring.dtd or XSD to give you code completion and hinting with your XML.

Now with a XML editor that supports XML Schemas (Eclipse Web Tools Project jumps to mind) and a quick XML schema declaration at the top of your XML, you now get total code-completion, and built in help with your XML elements. Makes life much easier!

AOP Custom XML Namespace and AOP Expressions

This is one of my favourite features, as it just make Aspect Oriented Programming with ColdSpring and absolute breeze.

Gone are the days of ProxyBeanFactories and NamedMethodAdvisors. Now you have a simple scripting language for defining where you want Aspects to be applied, and what you want them to do.

For example, if I had the following XML:

<beans xmlns="http://www.coldspringframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:aop="http://www.coldspringframework.org/schema/aop"
   xsi:schemaLocation="http://www.coldspringframework.org/schema/beans http://coldspringframework.org/schema/coldspring-beans-2.0.xsd
   http://www.coldspringframework.org/schema/aop http://www.coldspringframework.org/schema/coldspring-aop-2.0.xsd"
   >

   <!-- AOP configuration -->
   <aop:config>
      <aop:aspect ref="timer">
         <aop:around method="timeMethod" pointcut="execution(public * *(..))"/>
      </aop:aspect>
   </aop:config>

   <bean name="timer" class="com.Timer" />

   <bean name="fooService" class="com.FooService" />

</beans>


What this says is, for the given pointcut, execution(public * *(..)), which translates to any method execution, which is public, and returns any variable, with any method name, and any number of arguments (i.e. every method), call the method timeMethod on bean timer around that method.

So when do call fooService.doSomething(). Our Timer Component, will be able to log how long it took, and as you can see, no need for complicated ProxyBeanFactories, target beans or anything of the sort. All nice and clean and concise.

This is by far, just the surface of what is possible with the AOP XML namespace and AOP expressions in ColdSpring. There are more configuration options, and many more different types of expressions that are possible.

ColdFusion 9 ORM Integration

Injecting other objects into your ORM Entities can be a tricky prospect, but ColdSpring 2 comes bundled with a stack of utility objects that make this much easier, as well providing you with additional functionality to help you out with common ORM tasks as well.

ColdSpring 2 comes with a BeanInjectorEventHandler, whose job is to intercept when Entities are loaded, and inject them with whatever dependencies are loaded.

To intercept when new Entities are created, ColdSpring 2 has a SessionWrapper object that provides an interface to the underlying Hibernate Session, from which you can request new Entities, list, save, delete Entites and much more.

The SessionWrapper also enables some more advanced configuration options above and beyond ColdFusion’s basic settings, including being able to set a default Hibernate Session Flush Mode, and implementing a strict transaction mode as well.

This is just a start to the ORM integration, there is plenty more bundled into ColdSpring 2!

Multiple Bean Scope Support

ColdSpring 2 has a totally new and reworked bean creation process, so that not only can it create transient and singleton beans, but it can also tie beans to request and session scopes as well. To do this, it has a new scope attribute which replaces the old singleton attribute on beans.

Therefore to define a bean as a singleton, you not define:

<bean id=”fooService” class=”com.FooService” scope=”singleton”>


To define a  transient bean:

<bean id=”fooService” class=”com.FooService” scope=”prototype”>


To define a request scoped bean:

<bean id=”fooService” class=”com.FooService” scope=”request”>


(And I’m sure you have the pattern by now) To define a session scoped bean:

<bean id=”fooService” class=”com.FooService” scope=”session”>


This gives us even more control over the life-cycle of our beans, to enable some very powerful capabilities in our applications!

There is a lot more to ColdSpring 2 than just the above, but hopefully that will give you enough of a view to entice you to take the framework for spin.

More details can be found in the Release Notes, ColdSpring website, and Trac site.

Also, if you are interested in going into the running for winning a copy of ColdFusion Builder, check out the ColdSpring documentation competition currently running to aid in fleshing out the rest of the documentation for ColdSpring

Leave a Comment

Comments

  • Martijn van der Woud | October 25, 2011

    Great work Mark, thanks for all your hard work! I have been a happy ColdSpring user for years. The new features look awesome.