获得spring容器中的bean

ApplicationContext context = new FileSystemXmlApplicationContext(
			"file:F:/workspace/myproject/web/WEB-INF/configs/*-context.xml");
	MyAction myAction = (MyAction) context
			.getBean("myAction");


ApplicationContext context = new ClassPathXmlApplicationContext(
				"file:F:/workspace/zquery/WebRoot/WEB-INF/configs/*-context.xml");
		TestSvc testSvc = (TestSvc) context.getBean("testSvc");

你可能感兴趣的:(spring容器)