PDA

View Full Version : Flex+Spring?


egervari
Sep 28th, 2004, 06:33 PM
At first glance at Macromedia Flex (I really do mean a 30-minute glance over some PDF documentation), I think they really intended Flex to be used with EJBs and Web Services and not light-weight Java beans. The support for POJOs has been pushed aside due to Macromedia's target audience that is using these heavier technologies. I do realize the docs talk about using ordinary Java beans, but I got the impression that they were instantiated when needed and not meant to be facades or whatever. I also noticed that all objects are being called over an application-level protocol like SOAP or AMF, which seems rather bloated in of itself to me. I'm still up in the air if this really is an advantage over the typical page requests with respect to performance.

I also like the development side of things. MXML seems like decent technology, although it's a little verbose. But I can live with that considering the user experience is potentially much better.

Anyhow, I don't see any real way to get access to objects in Spring nicely by glancing the chapter on integrating with Java. The closest thing I could find was accessing a servlet's session variables, which doesn't really work for me. I'm just curious why they wouldn't let one access the application-scoped variables in the Servlet Context. I guess the light-weight audience was not catered to.

I'd like to try out Flex and see if I can get a few simple things to work. Are there any articles or docs on how to use Flex with Spring or is it just not a good idea to do yet? Anyone have experience with this personally? Is it even possible with Flex 1.0? Thanks for the reply.

mraible
Sep 29th, 2004, 12:30 AM
Since Flex can be integrated with Struts, I'm guessing you could easily use it with Spring.

http://www.markme.com/cc/archives/003887.cfm

egervari
Sep 29th, 2004, 08:19 AM
Well, that article is not very indepth, however I'm not very interested in using Flex as a view in the same way that I use HTML (Velocity/FreeMarker) or PDF views. I'm sure I could get this to work with Spring MVC or Aurora MVC but that's not taking advantage of solutions that Flex promises to solve. I want to use Flex as a true rich-client.

It does talk about the SOAP mechanisms, but he is merely just reiterating what the documentation already says. If I were to go to the trouble of making an article on making this stuff work, I'd provide some code to back it up since diagrams don't really do all that much for me :) I'm just more concerned on how to get to beans in a Spring bean factory because ultimately, that's where my business logic is. I'm not too concerned of leveraging MVC assets.

I've been longing for a rich-client environment that can hold state and provide the user experience that I think Flex can provide, but the documentation isn't very clear on how to do with Spring (which I guess is understandable) or just other ways. If you glance the docs, one just reads "Web Services" and "EJB" all over the place and these technologies don't really concern me. I don't use EJBs and I will only use Web Services if I need true application integration, otherwise a simple POJO layer will suffice. I think Flex should provide a way to call my beans and do all the middleware things (like Marshalling and so on) on my behalf. However, I think the product is clearly taking for granted that organizations using Flex have already bought into the hype of turing everything into a Web Service (not true by a long shot) and is making use of EJBs (since I guess that *must* be the only way of doing things in Java). It's pretty obvious it's targeting a specific audience.

Honestly, I'm not too sure how the controller part of the application should work or if it should exist at all (I'm guessing this is provided in Flex with the use of events and scripting). I think that with all the validation and binding concerns handled by Flex, there is very little need to use a controller with Flex. The main task is calling your services and being able to pass in arguments into plain Java methods. While I understand how to do all of this in Flex, it's getting to Spring that is the problem that I don't see a solution to.

katentim
Sep 29th, 2004, 08:30 AM
Here's an updated article with the code examples he refers to -
http://www.macromedia.com/devnet/flex/articles/struts.html

m.de.kwant
Aug 28th, 2007, 02:54 AM
Hi,

i have written a article (http://www.wowww.nl/wordpress/?p=58) describing the integration of Flex and Spring. a Code example is also provided.