在servlet中使用Spring注入

修改servlet 的 init 方法,添加以下代码:

SpringBeanAutowiringSupport.processInjectionBasedOnServletContext(this,  
	              config.getServletContext());  

  

就可在servlet中使用注入了:

@Autowired
	private MapApiconfigServiceI mapApiconfigService;

  

 

posted @ 2017-04-17 16:11  leechg  阅读(473)  评论(0编辑  收藏  举报