与spring的结合
首先下载springFactory.java,内容如下:
import org.springframework.context.ApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import flex.messaging.FactoryInstance;
import flex.messaging.FlexFactory;
import flex.messaging.config.ConfigMap;
import flex.messaging.services.ServiceException;
public class SpringFactory implements FlexFactory
{
private static final String SOURCE = "source";
public void initialize(String id, ConfigMap configMap) {}
public FactoryInstance createFactoryInstance(String id, ConfigMap properties)
{
SpringFactoryInstance instance = new SpringFactoryInstance(this, id, properties);
instance.setSource(properties.getPropertyAsString(SOURCE, instance.getId()));
return instance;
} // end method createFactoryInstance()
public Object lookup(FactoryInstance inst)
{
SpringFactoryInstance factoryInstance = (SpringFactoryInstance) inst;
return factoryInstance.lookup();
}
static class SpringFactoryInstance extends FactoryInstance
{
SpringFactoryInstance(SpringFactory factory, String id, ConfigMap properties)
{
super(factory, id, properties);
}
public String toString()
{
return "SpringFactory instance for id=" + getId() + " source=" + getSource() + " scope=" + getScope();
}
public Object lookup()
{
ApplicationContext appContext = WebApplicationContextUtils.getWebApplicationContext(flex.messaging.FlexContext.getServletConfig().getServletContext());
String beanName = getSource();
try
{
return appContext.getBean(beanName);
}
catch (NoSuchBeanDefinitionException nexc)
{
ServiceException e = new ServiceException();
String msg = "Spring service named '" + beanName + "' does not exist.";
e.setMessage(msg);
e.setRootCause(nexc);
e.setDetails(msg);
e.setCode("Server.Processing");
throw e;
}
catch (BeansException bexc)
{
ServiceException e = new ServiceException();
String msg = "Unable to create Spring service named '" + beanName + "' ";
e.setMessage(msg);
e.setRootCause(bexc);
e.setDetails(msg);
e.setCode("Server.Processing");
throw e;
}
}
}
}
接着在services-config.xml里加入:
<factories>
<factory id="spring" class="包名.SpringFactory"/>
</factories>
我们在applicationContext.xml里配置bean
<bean id="testFactory" class="HelloWorld"/>
在remoting-config.xml里加入:
<destination id="testFac">
<properties>
<factory>spring</factory>
<source>testFactory</source>
</properties>
</destination>
后台已经配置完毕,在前台:
<mx:RemoteObject id = "ro" endpoint="/TestFlex/messagebroker/amf" destination="testFac" result = "resultHandler(event)"/>
可以看出remoting-config.xml里配置起到了中转的作用
分享到:
相关推荐
flex+bleazeds+spring+hibernate配置的教程,有详尽过程,是flex与spring结合的不错的教程
flex+spring+blazeds在MyEclipse下非常详细的结合配置
flex 结合spring,完成前后台数据传递。
该文档描述了安装Flex,将FlashBulider嵌入到MyEclipse8.6中的安装过程,并且逐步将Flex+Spring+Hibernate结合的详细过程一一列出来,供大家参考
flex是一种强大的构建RIA系统的方案, 本文介绍了flex的关健技术及其数据服务的基本原理。 spring是一种轻量级的J2EE架构 , 本丈提出了一种结合flex和spring构建RIA系统的框架 , 并简要描述了其体实现
flex builder4 工程源码 博文链接:https://jhaij.iteye.com/blog/836570
详细描述了flex结合spring开发项目过程中的配置文件,以及所需要用到的技术和各个包文件
自己整了个文档,描述了Flex结合Spring的应用
结合spring,hibernate配置flex的学习,教你学会flex最基本的配置
更为重要的是,结合Spring的最新版本对过时的内容进行了更新,并增加了大量新内容,使《Spring技术内幕:深入解析Spring架构与设计原理(第2版)》更趋近于完美。《Spring技术内幕:深入解析Spring架构与设计原理...
这个文档我是自己写的,网络上也有着方面的文章,感觉说的都不是很清楚 。如看文档还不明白,可以和我发邮箱。 lizhen.san@163.com Flex爱好者
第三部分讲述了ACEGI安全框架、DM模块以及Flex模块等基于Spring的典型应用的设计与实现。 无论你是Java程序员、Spring开发者,还是平台开发人员、系统架构师,抑或是对开源软件源代码着迷的代码狂人,都能从...
第三部分讲述了ACEGI安全框架、DM模块以及Flex模块等基于Spring的典型应用的设计与实现。论你是Java程序员、Spring开发者,还是平台开发人员、系统架构师,抑或是对开源软件源代码着迷的代码狂人,都能从本书中受益...
第三部分讲述了ACEGI安全框架、DM模块以及Flex模块等基于Spring的典型应用的设计与实现。无论你是Java程序员、Spring开发者,还是平台开发人员、系统架构师,抑或是对开源软件源代码着迷的代码狂人,都能从本书中...
主要是实现了将最新的技术flex与java结合开发web实例,而且使用了ibates,spring 框架技术
Flex 是一个高效、免费的开源框架,可用于构建具有表现力的 Web应用程序,这些应用... 本课程主要是讲解Flex 4.6和ActionScript 3.0使用方法和技巧,并结合BlazDS/Spring /JPA/Hibernate等技术实现在线书店的开发过程。
apache shiro 是一个安全认证框架,和 spring security 相比,在于他使用了比较简洁易懂的认证和授权方式。...在这里主要讲解如何与 spring 结合、动态创建filterchaindefinitions、以及认证、授权、和缓存处理。
更为重要的是,结合Spring的最新版本对过时的内容进行了更新,并增加了大量新内容,使《Spring技术内幕:深入解析Spring架构与设计原理(第2版)》更趋近于完美。 《Spring技术内幕:深入解析Spring架构与设计原理...