报错:
Exception in thread "main" java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
解决:
main方法中没有传入xml文件为参数到ClassPathXmlApplicationContext方法中。
ClassPathXmlApplicationContextapplicationContext=newClassPathXmlApplicationContext("spring.xml");