错误写法:
cxt = new ClassPathXmlApplicationContext(); productService = (ProductService)cxt.getBean("productTypeServiceBean");
正确写法:
cxt = new ClassPathXmlApplicationContext("beans.xml"); productService = (ProductService)cxt.getBean("productTypeServiceBean");
原文:http://www.cnblogs.com/lomomiao/p/4269519.html