tags:

views:

125

answers:

1

Where should we declare the destinations and how to link applicationContext.xml and remoting-config.xml file?

A: 

Your services-config.xml should contain a line:

<service-include file-path="remoting-config.xml" />

Or something similar. When you add the Spring <flex:message-broker/> to your applicationContext.xml it automatically loads the the config from /WEB-INF/flex/services-config.xml. This will in turn load the remoting-config.xml file you specified (in this case it looks in the same path as services-config.xml). Spring also has hooks to override the default file location if you want.

You can then expose remoting destinations either with xml or annoations. In your xml file you can use the <flex:remoting-destination> element to specify which Spring beans you would like to expose. For example:

<bean id="productService" class="flex.samples.product.ProductServiceImpl" />
<flex:remoting-destination ref="productService" />

You can also specify at a method level what operations to include/exclude and what channels are available for that remoting destination.

If you've setup your applicationContext.xmlto use <context:annotation-config/> you can then just select what to expose via annotations. For example:

@Service("productService")
@RemotingDestination(channels={"my-amf","my-secure-amf"})
public class ProductServiceImpl implements ProductService {
etc...

*Caveat - I haven't used this a whole lot myself so if I'm wrong about something please correct me.

Jason Gritman
thank jason for ur reply
prasanth