SpringContextInitializerListener.java 文件源码

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

项目:cosmo 作者:
private void enhanceExistingSpringWebApplicationContext(ServletContextEvent sce, WebApplicationContext wac) {

    LOGGER.info("Enhancing existing Spring application context...");

    String cosmoContextLocation = sce.getServletContext().getInitParameter(CONTEXT_PARAM_NAME);

    @SuppressWarnings("resource")
    GenericXmlApplicationContext cosmoAppCtxt = new GenericXmlApplicationContext();
    cosmoAppCtxt.setEnvironment((ConfigurableEnvironment) wac.getEnvironment());
    cosmoAppCtxt.load(cosmoContextLocation);
    cosmoAppCtxt.refresh();
    cosmoAppCtxt.start();

    //make beans that are required from web components (as delegating filter proxy) accesible
    ((AbstractRefreshableWebApplicationContext)wac).getBeanFactory().setParentBeanFactory(cosmoAppCtxt.getBeanFactory());
    LOGGER.info("Enhanced existing Spring application context started");
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号