首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 媒体动画 > flex >

FLEX BlazeDS+Spring+Hibernate 配备成功(结合自己公司框架)

2012-09-18 
FLEX BlazeDS+Spring+Hibernate 配置成功(结合自己公司框架)}public Object lookup(){ApplicationContext

FLEX BlazeDS+Spring+Hibernate 配置成功(结合自己公司框架)

}
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;
}
}
}
}

=========================================================================================

3.services-config.xml:
<factories>
<factory id="spring" />
</factories>

=========================================================================================

4.SpringTest.java

package flex.samples;

public class SpringTest {

private String description;

public String getDescription() {
return "This description from String. [" + description + "]";
}

public void setDescription(String description) {
this.description = description;
}
}

======================================================================================5.applicationContext.xml

<bean id="springTest" destination="TestSpring" />
<mx:Button x="25" y="80" label="Call Spring" width="100" click="myspring.getDescription();" />
<mx:Label x="25" y="100" width="334" text="{myspring.getDescription.lastResult}"/>

热点排行