Flex BlazeDS Spring an Integration Story

adam

At the Melbourne Spring User Group (MSUG) meeting in Feb I presented on integrating an Adobe Flex Rich Internet Application with a J2EE services tier using Spring as the integration glue and BlazeDS for lightweight binary data transfer using ActionScript message Format (AMF). I have made the slides from that presentation available here.

Many people seem to think that their has to be some hard decision made about whether to go with the sexy flash based user interface of a Flex application, or the robust, scalable dependability delivered by a Java based application. I say “Why not have the best of both worlds?”. The approach I outline is completely Open Source and free and it is trivially easy to configure BlazeDS to use the Spring bean factory to expose a standard Spring service facade to remoting calls by a Flex application.

Documentation for BlazeDS can be found here. An explanation of the Adobe example Spring factory can be found here. it contains the source code as well. You will need to copy it and paste it into your project source tree.

I hope this is useful to people.


2 Responses to “Flex BlazeDS Spring an Integration Story”

  • Jon Says:

    Well, trivial is a tough thing to say!

    Scenario – I’m using Alfresco which has a huge API with a ton of spring beans that I could feasibly expose to BlazeDS. Unfortunately, for those of us that are not Java folks (more on the Flex end), doing so seems to be a daunting task.

    I think everyone needs more actual examples on how to expose a theoretical, already-existing bean on a server to remoting. What if you don’t have the actual Java classes for the beans? Do the beans automatically define the data types that are used for communication and BlazeDS can read those descriptors and use them?

    I’d love to try out BlazeDS but at the moment, it’s pretty difficult to get going.

  • adam Says:

    Sorry Jon, I wasn’t trying to say that the whole Blaze setup is trivial, just that wiring it into Spring once setup is. The link in my post provides the source code for the SpringFactory and you just add the following to your services-config.xml:

    <factories>
    <factory id=”spring” class=”blaze.SpringFactory” />
    </factories>

    The above assumes that you copied the source code to a file called SpringFactory.java in a folder called blaze under your application’s source folder. You can then add destinations to your remoting-config.xml file like the following, to reference your Spring bean services:

    <destination id=”loginService”>
    <properties>
    <factory>spring</factory>
    <source>loginManager</source>
    </properties>
    </destination>

    The above will expose a Spring bean with the id of loginManager as a remote object with the name loginService.

Leave a Reply