Today during a presentation about the use of Flex in enterprise scenarios, while I was illustrating the benefits of using the factory mechanism of BlazeDS to integrate it with Spring, a developer asked me why use Spring for Flex development (I guess he does not come from the Java world).
I think that the answer could be obvious to most of you but I want to share my thoughts with you about that topic. Feedbacks and opinions are appreciated :)
Spring is an open source framework that helps a lot the developers' life to make it easier.There some factors you have to consider when you develop a Java application. In fact using the standard JEE approach you'll tend to write a lot of unuseful and repeatedly code or implementing J2EE design patterns that are workarounds for technology limitations rather than real solutions to a problem. This is where Spring can save you a lot of time.
Spring uses the Inversion of Control (IoC) pattern that runs in any environment.
From Wikipedia: The Inversion of control - also known as IoC - is a concept, and an associated set of programming techniques, in which the control flow is inverted compared to the traditional interaction model expressed in imperative style by a series of procedure calls. Thus, instead of the programmer specifying, by the means of function calls, a series of events to happen during the lifetime of a programme, they would rather register desired responses to particular happenings, and then let some external entities take over the control over the precise order and set of events to happen.
The container used by Spring is very lightweight and reduces the startup time by instantiating components dependencies when it creates them.
Moving out the configuration code to provide dependencies we use Spring to assemble and manage the application components (Spring beans).
Spring Beans are Java objects so in order to access these Spring objects from Flex you have to use BlazeDS or Livecycle Data Services and then configure the destination to point at.
The essence of Spring is in providing enterprise services to Plain Old Java Objects (POJOs).
The POJO term was coined by Josh MacKenzie, Martin Fowler, and Rebbecca Parsons to intend a Java object that doesn't implement any special interfaces.
Then using the SpringFactory you can use Flex destinations with dependency-injected instances of Spring objects.
Having dependency injection containers allows you to configure the application consistently in one place.
The SpringFactory was developed by Jeff Vroom (http://weblogs.macromedia.com/lin/README.txt) and is also available on Adobe Exchange.
More information on the Spring framework can be found at the Spring's homepage. And don't miss the Christophe's article on Flex and Spring
Very good blog, I got a lot of things! If you need to watch, please click on my name, visit our website, where you need to be able to find watch and look forward to your visit! Thank you!
Posted by: Replica Rolex | September 19, 2010 at 11:55 AM
Have you given a look at Grails + Flex Plugin?
http://grails.org/Flex+Plugin
Seems to me that it connects Flex with Spring (Grails = Groovy (Java) + Hibernate + Spring) in a couple of simple steps.
Right now, all it needs is a good scaffolding Flex generation.
Posted by: Rodrigo Reyes | May 24, 2008 at 06:35 PM
Another approach to the IoC pattern: the Prana Framework:
http://www.pranaframework.org/
Posted by: Gilles Guillemin | April 23, 2008 at 10:01 AM