Servlet中调用Spring管理的Bean

来源:互联网 发布:网络黄金egd双涡轮登录 编辑:程序博客网 时间:2024/05/17 05:37
ServletContext servletContext = this.getServletContext();  WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext);  UserService userService = (UserService) wac.getBean("userService");//Spring 配置 中的 bean id 


原创粉丝点击