ssm整合MongoDb启动时出现无法将名称 'repository:auditing-attributes' 解析为 'attribute group' 组件异常

来源:互联网 发布:淘宝网首页登录 编辑:程序博客网 时间:2024/05/17 05:12

ssm整合MongoDb启动时出现无法将名称 ‘repository:auditing-attributes’ 解析为 ‘attribute group’ 组件异常


初始配置文件如下:

这里写图片描述

MongoDb相关的配置文件内容如下:

注意MongoDb的约束http://www.springframework.org/schema/data/repository/spring-repository-1.4.xsd , 这里使用了1.4的约束,问题就出在这,把1.4改为1.5就不会出问题了

<?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:p="http://www.springframework.org/schema/p"       xmlns:context="http://www.springframework.org/schema/context"       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-3.0.xsd                http://www.springframework.org/schema/data/mongo                http://www.springframework.org/schema/data/mongo/spring-mongo.xsd            http://www.springframework.org/schema/context            http://www.springframework.org/schema/context/spring-context.xsd            http://www.springframework.org/schema/data/repository              http://www.springframework.org/schema/data/repository/spring-repository-1.4.xsd ">    <!--<mongo:mongo host="" port="27017"/>-->    <mongo:mongo host="127.0.0.1" port="27017"/>    <!--mongodb 数据库账号和密码信息  -->    <bean id="userCredentials" class="org.springframework.data.authentication.UserCredentials">        <constructor-arg name="username" value="root"/>        <constructor-arg name="password" value="root123"/>    </bean>    <bean id="mongoTemplate" class="org.springframework.data.mongodb.core.MongoTemplate">        <constructor-arg ref="mongo"/>        <constructor-arg name="databaseName" value="test"/>        <constructor-arg ref="userCredentials"/>    </bean>    <context:component-scan base-package="cn.hurrican.mongodbdao.*"/></beans>

修改spring-mongodb.xml配置文件
这里写图片描述

参考链接

阅读全文
0 0