今天研究了下Flex4与Spring的集成,网上有很多相关内容,总结一下备用~
文中提到的方法适用于Spring版本大于2.5.6的情况。
1.建立Flex工程以后,在Web.xml中把关于Flex的配置信息全部删掉,添加Spring的<Servlet/>
2.在applicationContext.xml中添加Flex和Spring的命名空间,添加<flex:message-broker />,用于把前端请求路由给MessageBroker,再在<bean/>里面加上<flex:remoting-destination />,用于把<bean/>暴露给Flex。
3.在Flex中建立RemoteObject,destination属性要引用applicationContext.xml中已暴露的<bean/>。
4.删掉WEB-INF中flex目录下除了service-config.xml以外的其他配置文件,并在service-config.xml中修改<service/>中的内容为:
这样Flex就可以Spring顺利交互了~~~
当然,Flex中要通过RemoteObject的resultHandler方法来处理后台返回结果。
工程里面还要导Spring相应的包。
注:Spring的jar包List
1.Spring Framework
org.springframework.aop-3.0.2.RELEASE.jar
org.springframework.asm-3.0.2.RELEASE.jar
org.springframework.beans-3.0.2.RELEASE.jar
org.springframework.context-3.0.2.RELEASE.jar
org.springframework.core-3.0.2.RELEASE.jar
org.springframework.expression-3.0.2.RELEASE.jar
org.springframework.web.servlet-3.0.2.RELEASE.jar
org.springframework.web-3.0.2.RELEASE.jar
2.Spring Framework dependencies
org.aopalliance 内的 com.springsource.org.aopalliance-1.0.0.jar
edu.emory.mathcs.backport 内的 com.springsource.edu.emory.mathcs.backport-3.0.0.jar
net.sourceforge.cglib 内的 com.springsource.net.sf.cglib-2.2.0.jar
3.Spring BlazeDS Integration
org.springframework.flex-1.0.3.RELEASE.jar