日期:2014-05-18 浏览次数:20744 次
package cn.csdn.hr.service;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class Test {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
ApplicationContext context=new ClassPathXmlApplicationContext("applicationContext.xml");
//获取BeanFactory工厂创建的bean对象 得到一个bean实例对象
GreetingService greetingService = (GreetingService) context.getBean("geetingServiceBean");
greetingService.sayGeeting();
}
}