Thursday, October 29, 2009

ColdFusion + Spring?

After the recent additions of Hibernate, Ehcache and Solr (Lucene) to ColdFusion 9, it's starting to become really clear what ColdFusion does best: provide a clean and easy interface to powerful, open-source Java libraries.

With that being said, I would vote for Spring to be included next. While ColdSpring is great, why not go straight to the source? Not only would it allow for a tighter, seemless integration between ColdFusion and Java objects, but it would also leverage the power and performance of Java for our IoC and AOP needs. On top of that, Spring provides other services, such as integration with BlazeDS for Flex powered applications.

Just think, you could configure Spring inside your Application.cfc using this.iocEnabled and this.iocSettings.iocConfig. And if you didn't want to use XML, you could define your beans using annotations in your components (component beanid="userService" scope="singleton") and wire in your dependencies through properties (property name="userService" autowire="true";). It could look pretty similar to the way Hibernate was implemented.

Granted trying to integrate Spring into ColdFusion is probably easier said than done, but if they got it to work with Hibernate, I'm sure it could be done with Spring too.

3 comments:

  1. Tony I would have to agree, and I was surprised that it wasnt this time around.

    Imagine doing this in our persitent components

    component {

    property User;

    }

    And it would automatically inject the component in for us.

    But I guess we had to start somewhere in ColdFusion 9

    ReplyDelete
  2. @Andrew, isn't that similar to ColdSpring's auto-wiring?

    I might be wrong, but Spring seems to be pretty constrained by the Java type system. ColdSpring solves the IoC problem a little differently because CF is dynamically typed.

    ReplyDelete
  3. Or you could integrate with Spring right now...

    Check out JavaLoader 1.0's Spring integration:
    http://www.compoundtheory.com/javaloader/docs/

    (I hope that is right, for some reason I can't Paste into this comment field).

    ReplyDelete

Note: Only a member of this blog may post a comment.