找到對應的Configer類發現配置檔案的location配置如下:
@Configuration
@ImportResource(locations = {"magpiebeans.xml"})
修改為
@Configuration
@ImportResource(locations = {"classpath*:magpiebeans.xml"})
就ok了
問題是我之前把resource中的配置檔案copy到test的resource的目錄下 看編譯後的目錄配置檔案也在test-classes下 但是spring load配置檔案的時候同樣報FileNotFound異常