2009-12-04 115 views

回答

1

您服务-config.xml中应包含一行:

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

或类似的东西。当您将弹簧<flex:message-broker/>添加到applicationContext.xml时,它会自动从/WEB-INF/flex/services-config.xml加载配置。这将依次加载您指定的remoting-config.xml文件(在这种情况下,它看起来与services-config.xml的路径相同)。如果你愿意的话,Spring也有钩子来覆盖默认的文件位置。

然后,您可以使用xml或annoations公开远程目标。在您的xml文件中,您可以使用<flex:remoting-destination>元素来指定要公开哪些Spring bean。例如:

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

你也可以指定一个方法级别什么操作包含/排除哪些渠道可为远程目的地。

如果您已将applicationContext.xml设置为使用<context:annotation-config/>,那么您可以选择要通过注释公开的内容。例如:

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

*警告 - 我没有使用过这一大堆自己,所以如果我错了什么事,请大家指正。

+0

谢谢jason回复 – prasanth 2009-12-11 09:28:56