public void init(ServletConfig servletConfig) throws ServletException {
      ServletContext servletContext = servletConfig.getServletContext();
      WebApplicationContext webApplicationContext = WebApplicationContextUtils.getWebApplicationContext(servletContext);
      YOUR_BEAN = (YOUR_BEAN) webApplicationContext.getBean("your_bean_name");
 }

posted on 2013-05-10 00:18  梦中彩虹  阅读(324)  评论(0编辑  收藏  举报