怎么在servlet里面获取spring通过注解方式注入的service bean

2024-11-28 19:48:08
推荐回答(1个)
回答(1):

WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(session.getServletContext());
SessionService ss = wac.getBean(SessionService.class);
SessionService是自定义的service bean