ApplicationContext factory = ContextLoader.getCurrentWebApplicationContext(); factory.getBean("xml文件中的服务名");