1. 程式人生 > >No Spring WebApplicationInitializer types detected on classpath 載入不到配置檔案或找不到spring主配置

No Spring WebApplicationInitializer types detected on classpath 載入不到配置檔案或找不到spring主配置

第一種情況

在web.xml當中配置錯誤,沒有正確的引入spring的配置檔案。找不到時,報告次錯誤。

檢查配置檔案,引入是否正確。

classpath:springconfig.xml ,這個格式的配置為讀取本專案classpath下的檔案

classpath*:springconfig.xml 這個格式的配置為讀取本專案下或者是jar包的classpath下的配置檔案。多個同名只讀第一個。

第二種情況

No Spring WebApplicationInitializer types detected on classpath 

tomacat 伺服器載入jar 不全 ,導致啟動錯誤。

使用編譯器 maven clean  下。在clean 下專案。

第三種情況

lag4j.properties 配置檔案的載入 

這個配置檔案一般要配置到當前目錄中。web.xml 當中引入日誌配置檔案時,使用classpath*:log4j.properties 配置引數,如果檔案在jar包,會報錯:找不到此檔案。