读书人

Flex跟spring集成时需要的SpringFacto

发布时间: 2012-09-22 21:54:54 作者: rapoo

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

读书人网 >flex

热点推荐