解决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");