2009-12-04 78 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