Integrate Flex with Spring Framework
As rich-Internet application (RIA) technologies mature, it is becoming increasingly important to integrate RIA, such as Adobe Flex applications, with robust server-side services. One of Java developers' favorite server-side frameworks, Spring, could play an important role in this process.
Marco Casario of RIAvolutionize the Web explains why he recommends BlazeDS to Spring integrate the Flex enterprise system, saying, “Spring is an open-source framework that helps make the developer's life easier. Using standard JEE approach, you'll tend to write a lot of code that is not useful or redundant or spend time implementing J2EE design patterns that are workarounds for technology limitations rather than real solutions. By cutting out these processes, Spring can save you a lot of time.”
Christophe Coenraets provides the rationale for integrating Flex with Spring:
The whole idea behind Spring Inversion of Control (IoC) is to let the container instantiate components (and inject their dependencies). By default, however, components accessed remotely by a Flex client are instantiated by Flex destinations at the server-side. The key to the Flex/Spring integration is, therefore, to configure the Flex destinations to let the Spring container take care of instantiating Spring beans. The Flex data services support the concept of factory to enable this type of custom component instantiation. The role of a factory is simply to provide ready-to-use instances of components to a Flex destination, instead of letting the Flex destination instantiate these components itself.
With respect to the integration of Flex, Spring, IBATIS and Cairngorm, Chris Giametta remarks:
I believe in creating a consistent, modular, and repeatable architecture. The architecture must be sufficient to support small applications as well as extremely robust enterprise applications. A key to project success is creating an architecture that new developers can rapidly integrate themselves into and begin to be productive on day one. I feel that Flex combined with Spring, iBATIS, and Cairngorm help me to quickly produce a patterned- based, repeatable architecture.
Sébastien Arbogast went to the effort of creating a blog series to demonstrate how to build a full stack of Flex, BlazeDS and Spring integration.
Arbogast's stack, from the bottom up, includes JBoss as the application server, MySQL as the data storage, Hibernate to help data access, Spring to build the business layer, BlazeDS as the remoting service and Flexe-genial for building rich client. The system was built using Maven with flex-compiler-mojo plug-in.
Arbogast says, “This project setup certainly requires a bit of work, but—setting aside a small issue with configuration file duplication that should be fixed soon—it's pretty clean, and flex-compiler-mojo works really great.”
Just a small precision
by
Sébastien Arbogast
Flex and Spring integration with Cinnamon remoting
by
Jens Halm
<bean id="someService" class="example.SomeClass">
<cinnamon:export-service service-interface="example.SomeInterface"/>
</bean>
Furthermore Cinnamon adds a few features not available elsewhere:
- Support for pure AS3 clients (no Flex SDK required)
- Support for Java clients (if you need remoting from Flex *and* Java rich clients you can use the same protocol: AMF3)
- Ant Task for generating type-safe AS3 remoting stubs
- Integration with Parsley (www.spicefactory.org/parsley/), an AS3 IOC framework (if you are using Spring you might also want to use an IOC container in the Flash/Flex client).
- Scheduled for later this summer is integration with Pimento, a data management framework that adds JPA/Hibernate integration to Cinnamon remoting.
Re: Flex and Spring integration with Cinnamon remoting
by
Sébastien Arbogast
Re: Flex and Spring integration with Cinnamon remoting
by
Jens Halm
Seriously, I'm not sure if I understand the question. In my previous comment I listed several Cinnamon features that are not available in other products like support for pure AS3 clients and deep integration with Spring. And since these were/are often requirements for our own projects we pretty much did not have another choice than to roll our own. GraniteDS was already available when we started last summer but it didn't seem easy to add these features to their existing architecture.
I think BlazeDS, GraniteDS and Cinnamon all have a slightly different focus so I'd say they all have their "right to exist". We know developers who used to work with GraniteDS and then changed to Cinnamon and are much happier now. I guess this might be the other way around for other devs. Why are there hundreds of Java web frameworks? ;-)
Igenko
by
Sébastien Deleuze
Re: Flex and Spring integration with Cinnamon remoting
by
Sébastien Arbogast
Re: Flex and Spring integration with Cinnamon remoting
by
Sébastien Deleuze
Spring integration is natively supported by GraniteDS, we use it from the beginning on Igenko, and it works very well. It also already supports Hibernate lazy loading.
Re: Flex and Spring integration with Cinnamon remoting
by
Jens Halm
Yes, I briefly discussed with Franck about joining forces but we came to the conclusion that currently it's better to continue separately. It's not just about adding features, some of them might require architectural changes. With Spring integration it's not just about invoking Spring beans from Flex/Flash, we also support using Spring to configure Cinnamon, so the steps needed to expose an existing service for Flex/Flash clients are minimal for Spring users. Furthermore Cinnamon is not only a standalone product but also integrated with other Spicefactory Open Source projects like Parsley (which combines an AS3 IOC container with an MVC framework) and Pimento, the upcoming data management framework which will support a lot more for JPA/Hibernate than just lazy loading.
I mean, if you are happy with GraniteDS you should obviously stick with it but others might be happy to have choices.
Flex - Grails plugin
by
Rodrigo Reyes
grails.org/Flex+Plugin
Seems to me it connects Flex and Spring (Grails = Groovy (Java) + Spring + Hibernate) in a couple of simple steps.
All it needs right now is a good scaffolding Flex generation.
Rodrigo
Educational Content
Concurrency in Clojure
Stuart Halloway May 17, 2013
Confessions of an Agile Addict
Ole Friis Østergaard May 16, 2013
Web Development: You're Doing It Wrong
Stefan Tilkov May 16, 2013
Programming The Feynman Way
Ben Evans May 15, 2013





Hello stranger!
You need to Register an InfoQ account or Login to post comments. But there's so much more behind being registered.Get the most out of the InfoQ experience.
Tell us what you think