spring整合flex
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/application-config.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- Map /spring/* requests to the DispatcherServlet -->
<servlet-mapping>
<servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
<url-pattern>/spring/*</url-pattern>
</servlet-mapping>
</web-app>
创建的Servlet可以处理这个请求,http://localhost:8080/test-server/spring
这是访问BlazeDS的基本的URL。当然这也是Spring标准的DispatcherServlet.
现在已经把Spring整合到Java web工程中了。要整合BlazeDS,就要修改下Spring的配置文件。 application-config.xml文件如下
Xml代码
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="/schema/beans"
xmlns:xsi="/2001/XMLSchema-instance"
xmlns:flex="/schema/flex"
xsi:schemaLocation="
/schema/beans
/schema/beans/spring-beans-2.5.xsd
/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>
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="/schema/beans"
xmlns:xsi="/2001/XMLSchema-instance"
xmlns:flex="/schema/flex"
xsi:schemaLocation="
/schema/beans
/schema/beans/spring-beans-2.5.xsd