WebApplicationContextLoader.java 文件源码

java
阅读 26 收藏 0 点赞 0 评论 0

项目:alfresco-data-model 作者:
/**
 * Provides a static, single instance of the application context.  This method can be
 * called repeatedly.
 * <p/>
 * If the configuration requested differs from one used previously, then the previously-created
 * context is shut down.
 * 
 * @return Returns an application context for the given configuration
 */
public synchronized static ConfigurableApplicationContext getApplicationContext(ServletContext servletContext, String[] configLocations)
{
    AbstractApplicationContext ctx = (AbstractApplicationContext)BaseApplicationContextHelper.getApplicationContext(configLocations);

    CmisServiceFactory factory = (CmisServiceFactory)ctx.getBean("CMISServiceFactory");

    DefaultListableBeanFactory dlbf = new DefaultListableBeanFactory(ctx.getBeanFactory());
    GenericWebApplicationContext gwac = new GenericWebApplicationContext(dlbf);
    servletContext.setAttribute(GenericWebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, gwac);
       servletContext.setAttribute(CmisRepositoryContextListener.SERVICES_FACTORY, factory);
    gwac.setServletContext(servletContext);
    gwac.refresh();

    return gwac;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号