項目中運行報錯: Loading XML bean definitions from class path resource [applicationContext.xml]


  記錄一下:

org.springframework.context.support.AbstractApplicationContext prepareRefresh
Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@7cef4e59: startup date [Fri Sep 30 09:33:28 CST 2016]; root of context hierarchy
org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
Loading XML bean definitions from class path resource [applicationContext.xml]

    Loading XML bean definitions from class path resource [applicationContext.xml] 今天小伙伴遇到了這個了問題。

    原因是,在創建spring項目后,缺少日志jar所導致的問題,所以只需要導入相應的日志jar即可。

 

日志jar相關:

  commons-logging:避免和具體的日志方案直接耦合,通過統一接口解耦。

  log4j:最典型日志解決方案。具體的日志系統 。通過 slf4j-log4j12初始化Log4j,達到最終日志的輸出。

  slf4j(Simple Logging Facade for Java):為java提供的簡單日志門面。slf4j入口是眾多接口的集合,所有接口都定義在 slf4j-api 中

                              (注:導入時不要同時出現多個實現slf4j的包出現,否則編譯時 會報錯

  slf4j-api:本質上 slf4j-api是個接口定義

  slf4j-log4j12:鏈接slf4j-api和log4j中間的適配器,實現了slf4j-apiz中StaticLoggerBinder接口,從而使得在編譯時綁定的是slf4j-log4j12的 getSingleton()方法

 

 

在Mybatis+spring項目中,習慣直接拷入這幾個jar

 

         

 

 


                                          

記錄點點滴滴,雖然微不足道。                  

 

 

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM