普通java类获取spring的bean

获取ApplicationContext.xml中的bean

BeanFactory factory = new ClassPathXmlApplicationContext("classpath:/applicationContext*.xml");            

ITestService testService = (ITestService)factory.getBean("testService"); 

猜你喜欢

转载自tagalin.iteye.com/blog/1671341