解决springjava.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh'异常

错误写法:

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

 正确写法:

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

 

posted @ 2015-02-03 11:17  _启明  阅读(7538)  评论(0编辑  收藏  举报