spring的項目中有時候會報錯:java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContexthtml
緣由:spring初始化bean對象出錯;1)xml的bean的id 有重複;java
2)若是是註解配置:多是註解的名稱有重複:spring
只須要將重複的bean 的id和重複的註解改了就好了;post