具体过程参见:http://coenraets.org/flex-spring/
简要描述一下:
1、首先要继承FlexFactory,实现Spring与Flex的集成,上文中已经提供了具体实现,下载即可。
2、在web.xml中配置Spring,如下:
<
context-param
>
< param-name > contextConfigLocation </ param-name >
< param-value > /WEB-INF/applicationContext.xml </ param-value >
</ context-param >
< listener >
< listener-class > org.springframework.web.context.ContextLoaderListener </ listener-class >
</ listener >
< param-name > contextConfigLocation </ param-name >
< param-value > /WEB-INF/applicationContext.xml </ param-value >
</ context-param >
< listener >
< listener-class > org.springframework.web.context.ContextLoaderListener </ listener-class >
</ listener >
3、在service-config.xml配置文件中添加
<
factories
>
< factory id ="spring" class ="flex.samples.factories.SpringFactory" />
</ factories >
< factory id ="spring" class ="flex.samples.factories.SpringFactory" />
</ factories >
4、修改remote-config.xml中原有的destination配置,原为:
<
properties
>
< source > com.bluesky.flexpsp.PsPDataService </ source >
</ properties >
< source > com.bluesky.flexpsp.PsPDataService </ source >
</ properties >
修改为:
<
properties
>
< factory > spring </ factory > <!-- spring为第三步中的factoryID -->
< source > pspDataService </ source > <!-- pspDataService为bean的id -->
</ properties >
< factory > spring </ factory > <!-- spring为第三步中的factoryID -->
< source > pspDataService </ source > <!-- pspDataService为bean的id -->
</ properties >