項目以前正常啓動,並未改動其相關功能文件,出錯:
(前提是保證沒有標籤寫錯,少寫或寫錯逗號、標籤結尾符等低級錯誤,在以前正確無誤的情況下突然某天報錯)
target/classes/spring-mongo.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 17; columnNumber: 46; cvc-complex-type.2.4.a: Invalid content was found starting with element 'mongo:client-options'. One of '{"http://www.springframework.org/schema/data/mongo":client-settings}' is expected.
言下之意是 mongo:client-options 標籤下屬性出錯,可能不存在或屬性改變。
究其原因,發現 beans 標籤引入的 xmlns:xsi mongo爲 https://www.springframework.org/schema/data/mongo/spring-mongo.xsd
未指定版本號,其默認使用最新版本,版本升級導致屬性改變,
進入:http://www.springframework.org/schema/data/mongo/ 驗證版本及更新時間
解決方式:指定上一版本或以前版本號
如:https://www.springframework.org/schema/data/mongo/spring-mongo-2.2.xsd
即可解決