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

Flex跟spring集成时需要的SpringFactory

2012-09-22 
Flex和spring集成时需要的SpringFactory}public Object lookup(){ApplicationContext appContext WebApp

Flex和spring集成时需要的SpringFactory

  1. }
  2. public Object lookup() {
  3. ApplicationContext appContext = WebApplicationContextUtils.getWebApplicationContext(flex.messaging.FlexContext.getServletConfig().getServletContext()); String beanName = getSource();
  4. try
  5. { return appContext.getBean(beanName);
  6. } catch (NoSuchBeanDefinitionException nexc)
  7. { ServiceException e = new ServiceException();
  8. String msg = "Spring service named '" + beanName + "' does not exist."; e.setMessage(msg);
  9. e.setRootCause(nexc); e.setDetails(msg);
  10. e.setCode("Server.Processing"); throw e;
  11. } catch (BeansException bexc)
  12. { ServiceException e = new ServiceException();
  13. String msg = "Unable to create Spring service named '" + beanName + "' "; e.setMessage(msg);
  14. e.setRootCause(bexc); e.setDetails(msg);
  15. e.setCode("Server.Processing"); throw e;
  16. } }
  17. }
  18. }

热点排行