PortletApplicationContextUtils.java 文件源码

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

项目:spring4-understanding 作者:
/**
 * Register web-specific scopes ("request", "session", "globalSession")
 * with the given BeanFactory, as used by the Portlet ApplicationContext.
 * @param bf the BeanFactory to configure
 * @param pc the PortletContext that we're running within
 */
static void registerPortletApplicationScopes(ConfigurableListableBeanFactory bf, PortletContext pc) {
    bf.registerScope(WebApplicationContext.SCOPE_REQUEST, new RequestScope());
    bf.registerScope(WebApplicationContext.SCOPE_SESSION, new SessionScope(false));
    bf.registerScope(WebApplicationContext.SCOPE_GLOBAL_SESSION, new SessionScope(true));
    if (pc != null) {
        PortletContextScope appScope = new PortletContextScope(pc);
        bf.registerScope(WebApplicationContext.SCOPE_APPLICATION, appScope);
        // Register as PortletContext attribute, for ContextCleanupListener to detect it.
        pc.setAttribute(PortletContextScope.class.getName(), appScope);
    }

    bf.registerResolvableDependency(PortletRequest.class, new RequestObjectFactory());
    bf.registerResolvableDependency(PortletResponse.class, new ResponseObjectFactory());
    bf.registerResolvableDependency(PortletSession.class, new SessionObjectFactory());
    bf.registerResolvableDependency(WebRequest.class, new WebRequestObjectFactory());
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号