架构师之spring-------spring注入servlet

1.前言.
  如题.
2.代码.
注入方法::在Servlet的init方法中增加以下代码:

public void init(ServletConfig config) throws ServletException {
   SpringBeanAutowiringSupport.processInjectionBasedOnServletContext(this,
         config.getServletContext());
}


  感谢帅6子517 的文章:
http://zhidao.baidu.com/link?url=lFiT56hR8vTPr61OgoaYNTOcXQoGNanjMMfBnlZN_foaA8ePsijqx68mjWWUtPkjfR-rJw0dsuXLhFD8yv1oF6Ov9auc8zwqXuOx-xrh0he

猜你喜欢

转载自nannan408.iteye.com/blog/2220155