cvc-complex-type.2.4.c: 通配符的匹配很全面, 但無法找到元素 'mongo:mongo' 的聲明

今天在spring中整合mongodb,我參考官網的配置配置xml如下:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xmlns:context="http://www.springframework.org/schema/context"
          xmlns:mongo="http://www.springframework.org/schema/data/mongo"
          xsi:schemaLocation=
          "http://www.springframework.org/schema/context
          https://www.springframework.org/schema/context/spring-context.xsd
          http://www.springframework.org/schema/data/mongo https://www.springframework.org/schema/data/mongo/spring-mongo.xsd
          http://www.springframework.org/schema/beans
          https://www.springframework.org/schema/beans/spring-beans.xsd">

    <!-- Default bean name is 'mongo' -->
    <mongo:mongo host="${mongo.address}" port="27017" />

</beans>

因爲我的spring以及spring-boot版本都較低,因爲用的是mongo:mongo而不是mongo:mongo-client,結果啓動報錯

Caused by: org.xml.sax.SAXParseException; lineNumber: 14; columnNumber: 57; cvc-complex-type.2.4.c: 通配符的匹配很全面, 但無法找到元素 'mongo:mongo' 的聲明

於是網上搜索,什麼版本不對,schema沒有添加,結果還是一樣沒用,突然發現這裏的schema有以https開頭的,莫非是訪問不了?於是全改成http,OK了

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章