您的位置:首页 > 编程语言 > Java开发

Servlet中调用Spring管理的Bean

2012-06-28 18:23 387 查看
ServletContext servletContext = this.getServletContext();
WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext);
UserService userService = (UserService) wac.getBean("userService");//Spring 配置 中的 bean id
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: