3.3. Using the FlexRemotingServiceExporter

The FlexRemotingServiceExporter is used to export existing Spring-managed services for direct remoting from a Flex client. Given the following Spring bean definition for a productService bean:

    
<bean id="productService" class="flex.samples.product.ProductServiceImpl" />
    	

and assuming the existance of a Spring-managed MessageBroker with a bean name of mySpringManagedMessageBroker, the following FlexRemotingServiceExporter definition will expose the service for remoting to the Flex client as a remote service destination named product:

<!-- Expose the productService bean for BlazeDS remoting -->
<bean id="product" class="org.springframework.flex.messaging.remoting.FlexRemotingServiceExporter">
    <property name="messageBroker" ref="mySpringManagedMessageBroker"/>
    <property name="service" ref="productService"/>
</bean>
    	

By default, the remote service destination exposed to the Flex client will use bean name of the FlexRemotingServiceExporter as the service id of the destination, but this may be overridden using the serviceId property.

The methods that are exposed to be called by the Flex client can be more tightly controlled through used of the includeMethods and excludeMethods properties of the FlexRemotingServiceExporter.