MONGO + SPRING: 匹配的通配符是严格的,但是找不到元素'mongo:db-factory'的声明
MONGO + SPRING: The matching wildcard is strict, but no declaration can be found for element 'mongo:db-factory'
如何解决这个错误?
上下文内容:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.springframework.org/schema/beans"
xmlns:mongo="http://www.springframework.org/schema/data/mongo" xsi:schemaLocation=
"http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.2.xsd">
<mongo:db-factory dbname="#{properties.getProperty('mongo.database')}"
password="#{properties.getProperty('mongo.password')}"
username="#{properties.getProperty('mongo.user')}"
port="#{properties.getProperty('mongo.port')}"
host="#{properties.getProperty('mongo.host')}"/>
Spring 和 Mongo 版本:
4.3.2.RELEASE
3.3.0
您缺少 mongo
命名空间的架构位置:
<?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:mongo="http://www.springframework.org/schema/data/mongo"
xsi:schemaLocation="http://www.springframework.org/schema/data/mongo
http://www.springframework.org/schema/data/mongo/spring-mongo.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.2.xsd">
如何解决这个错误?
上下文内容:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.springframework.org/schema/beans"
xmlns:mongo="http://www.springframework.org/schema/data/mongo" xsi:schemaLocation=
"http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.2.xsd">
<mongo:db-factory dbname="#{properties.getProperty('mongo.database')}"
password="#{properties.getProperty('mongo.password')}"
username="#{properties.getProperty('mongo.user')}"
port="#{properties.getProperty('mongo.port')}"
host="#{properties.getProperty('mongo.host')}"/>
Spring 和 Mongo 版本:
4.3.2.RELEASE
3.3.0
您缺少 mongo
命名空间的架构位置:
<?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:mongo="http://www.springframework.org/schema/data/mongo"
xsi:schemaLocation="http://www.springframework.org/schema/data/mongo
http://www.springframework.org/schema/data/mongo/spring-mongo.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.2.xsd">