报错信息:java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
BeanFactory没有实例化或者已经关闭,原因:ApplicationContext ctx = new ClassPathXmlApplicationContext();Spring实例化BeanFactory的时候是默认到classPath下面查找名为applicationContext.xml的文件。但是这正是这个错误的原因:ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");如果这样的话就不会出现这样的错误了。
BeanFactory没有实例化,找applicationContext.xml,看看你的工厂怎么配置的,可能没找到相关类,你按着ctrl用鼠标滑过,看能点击进去么,
能就是配置有,不能就是没配对
没有实例化Bean工厂,看看是不是找不到配置文件。。。
实例化bean工厂时出错了,点进去看一下你的bean
去看看你写的javabean对象,非法状态异常错误。