修改servlet 的 init 方法,添加以下代码:
SpringBeanAutowiringSupport.processInjectionBasedOnServletContext(this,
config.getServletContext());
就可在servlet中使用注入了:
@Autowired
private MapApiconfigServiceI mapApiconfigService;
修改servlet 的 init 方法,添加以下代码:
SpringBeanAutowiringSupport.processInjectionBasedOnServletContext(this,
config.getServletContext());
就可在servlet中使用注入了:
@Autowired
private MapApiconfigServiceI mapApiconfigService;
转载于:https://www.cnblogs.com/Leechg/p/6723428.html