Essential Spring-Flex Configuration for Messaging
In this section you will learn the essentials of Spring-Flex configuration, especially those that relate to message based interactions between the two. To keep things lively and in context, I will use the help of a simple example application that you can build along as you read this and the following sections.
As a first step open Flex Builder (now called Flash Builder) and create a new Flex project. Choose a Java EE (J2EE) server side and opt to create a combined Java/Flex project using Web Tools Platform (WTP). You will have the choice to leverage WTP only if you have the corresponding Eclipse plug-in installed. I name my project: “FlexSpringJMSExample”. You can use the same name or any other that you like. Your screen should look like Figure 1.
Once you click “next” the Flex Builder project creation wizard will take you to the next screen where you will be required to provide the following pieces of information:
- Target runtime – the application server where the application will be deployed. In my case, a local JBoss instance is configured. If you don’t have once configured, click the “New” button next to this form field and follow along to create one.
- Context root – The “context root” of a web application determines which URLs are handled by your web application. It’s the root of your web application.
- Context folder – The folder where all the web content resides.
- Flex WAR file – Old names sometimes stick for too long! LifeCycle Data Services (LCDS) and its open source extract BlazeDS, emerge from an earlier Adobe product called Flex Data Services, which was packaged under the name of flex.war. This form field expects you to point to the blazeds.war file in your file system.
- Compilation options – You have a choice to compile locally, which I would recommend for development, or compile on the server.
- Output folder – The folder where you want the compiled Flex output of your application to reside.
Look at Figure 2 to see what the corresponding screen for me looks like.
Clicking “next” at this second screen will take you to the last and final screen of the Flex Builder project creation wizard. In the last screen you will need to specify the following:
- Main source folder – usually the default value of flex_src suffices in most cases.
- Main application file – This is the name of the main Flex application file. Usually the default value is the same as the name of the application with “.mxml” appended to it. I like to keep it small and simple and stick to the convention of calling it main.mxml.
- Output folder URL – the URL to access the application. Default works in this case.
Once you click “Finish” on this screen, the Flex/Java project with your required initial configuration is setup. The project folder structure as viewed in the “Flex Development” perspective should be as shown in Figure 3.
So far the project creation and setup has shown default behavior and not included anything specific to Spring or the Spring Flex project.