天天看點

JSP中擷取spring 容器

JSP中擷取spring 容器

// 擷取spring容器  

        applicationcontext ctx = webapplicationcontextutils.getwebapplicationcontext(this.getservletcontext());  

        // 插件資料初始化  

        icommonservice commonservice = (icommonservice) ctx.getbean("commonservice");  

        commonservice.init();  

JSP中擷取spring 容器

servletcontext context = request.getsession().getservletcontext();  

        applicationcontext ctx = webapplicationcontextutils  

                .getwebapplicationcontext(context);