Flex跟spring集成时需要的SpringFactory
Flex和spring集成时需要的SpringFactory}public Object lookup(){ApplicationContext appContext WebApp
Flex和spring集成时需要的SpringFactory
- }
- 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;
- } }
- }
- }