ServletContext application = ServletActionContext.getRequest().getSession().getServletContext();
ApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(application);
// WebApplicationContextUtils.getRequiredWebApplicationContext(application);
UserDao bd = (UserDao)context.getBean(spring中配置bean ID的名称);
通过WebApplicationContextUtils工具类获取ApplicationContext对象
最新推荐文章于 2022-04-15 17:26:07 发布