1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<%
     /**
         jsp中获得spring的webApplicationContext:
     */
     //1.方法一:
     //WebApplicationContext context = WebApplicationContextUtils.getRequiredWebApplicationContext(this.getServletConfig().getServletContext());
       
     //方法二:
   // WebApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(request.getSession().getServletContext());
       
     //方法三:
     //WebApplicationContext context  = WebApplicationContextUtils.getWebApplicationContext(this.getServletContext());
       
     //方法四:
     WebApplicationContext context = (WebApplicationContext)config.getServletContext().getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
       
       
       
     TaobaoAccountCheckService taobaoAccountCheckServiceImpl = (TaobaoAccountCheckService)context.getBean( "taobaoAccountCheckServiceImpl" );
     List<Map<String, Object>> list =  taobaoAccountCheckServiceImpl.getIncomePureUnsave();
     System.out.println( "size:"  + list.size());
%>