原文:解決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.g ...

2015-02-03 11:17 0 5981 推薦指數:

查看詳情

BeanFactory not initialized or already closed - call 'refresh' before access

遇到這種錯誤的時候,看到網上很多人都是建議這么解決BeanFactory沒有實例化或者已經關閉了,其實產生錯誤的原因很簡單,在寫: ApplicationContext ctx = new ClassPathXmlApplicationContext(); 時,沒有指定配置文件 ...

Tue Aug 23 22:17:00 CST 2016 1 4275
 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM