1.spring容器注入bean
2.WebApplicationContext context = WebApplicationContextUtils.getRequiredWebApplicationConte(servletContext);
ServiceName serviceName = context.getBean("serviceName");
3.ApplicationContext context = new ClassPathXmlApplicationContext("beans.xml");
ServiceName serviceName = context.getBean("serviceName");