错误写法:

			cxt = new ClassPathXmlApplicationContext();
			productService = (ProductService)cxt.getBean("productTypeServiceBean");
		

 正确写法:

	          cxt = new ClassPathXmlApplicationContext("beans.xml");
			productService = (ProductService)cxt.getBean("productTypeServiceBean");

 

相关文章: