spring整合flex
/schema/flex
/schema/flex/spring-flex-1.0.xsd">
<!-- Spring Beans’s -->
<bean id="myService" class="MyServiceImpl" />
<!-- Simplest possible message broker -->
<flex:message-broker/>
<!-- exposes myService as BlazeDS destination -->
<flex:remoting-destination ref="myService" />
</beans>
通过配置,使BlazeDS接口开放。首先要添加Flex的namespace。添加之后,使用message-broker标签创建MessageBrokerFactoryBean。看下配置只是个简单标签。配置是默认的。要确保WEB-INF/flex 下有service-config.xml这个配置文件。remoting-destination标签使Spring bean变为远程目标。
接下来修改默认的BlazeDS service-config.xml文件。代码如下
Xml代码
<?xml version="1.0" encoding="UTF-8"?>
<services-config>
<services>
<default-channels>
<channel ref="my-amf" />
</default-channels>
</services>
<channels>
<channel-definition id="my-amf"
class="mx.messaging.channels.AMFChannel">
<endpoint
url="http://{}:{server.port}/{context.root}/spring/messagebroker/amf"
class="flex.messaging.endpoints.AMFEndpoint" />
</channel-definition>
<channel-definition id="my-polling-amf"
class="mx.messaging.channels.AMFChannel">
<endpoint
url="http://{}:{server.port}/{context.root}/spring/messagebroker/amfpolling" class="flex.messaging.endpoints.AMFEndpoint" />
<properties>
<polling-enabled>true</polling-enabled>
<polling-interval-seconds>4</polling-interval-seconds>
</properties>
</channel-definition>
</channels>