spring-data-mongodb整合时遇到的问题

1.Error creating bean with name 'mongoTemplate': Lookup method resolution failed;

Caused by: java.lang.ClassNotFoundException: org.springframework.data.mapping.MappingException

解决:缺少spring-data-commons依赖
<dependency>
    <groupId>org.springframework.datagroupId>
    <artifactId>spring-data-commonsartifactId>
    <version>2.0.5.RELEASEversion>
dependency>
<dependency>
    <groupId>org.springframework.datagroupId>
    <artifactId>spring-data-mongodbartifactId>
    <version>2.0.5.RELEASEversion>
dependency>

2.Causedby: org.xml.sax.SAXParseException; systemId: http://www.springframework.org/schema/data/mongo/spring-mongo.xsd; lineNumber: 228; columnNumber: 63; src-resolve: 无法将名称 'repository:auditing-attributes' 解析为 'attribute group' 组件。

解决:jar冲突,移除spring-data-commons-core

3.通配符的匹配很全面, 但无法找到元素 'mongo:mongo-client' 的声明

解决:Schema约束

 
  
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
          http://www.springframework.org/schema/context/spring-context.xsd
          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.xsd">

你可能感兴趣的:(bug)