创建名称为“mongoTemplate'

时间:2015-07-02 17:16:01

标签: java spring mongodb

  

org.springframework.beans.factory.BeanCreationException:创建名称为&m; 39的mongoTemplate'   在com.socketcruiter.config.SpringMongoConfig类中定义:bean的实例化失败;   嵌套异常是org.springframework.beans.factory.BeanDefinitionStoreException:   工厂方法[public org.springframework.data.mongodb.core.MongoTemplate org.springframework.data.mongodb.config.AbstractMongoConfiguration.mongoTemplate()   抛出java.lang.Exception]抛出异常;嵌套异常是org.springframework.beans.factory.BeanCreationException:    创建名称为' mappingMongoConverter'的bean时出错在com.socketcruiter.config.SpringMongoConfig类中定义:    bean的实例化失败;嵌套异常是org.springframework.beans.factory.BeanDefinitionStoreException:    工厂方法[public org.springframework.data.mongodb.core.convert.MappingMongoConverter org.springframework.data.mongodb.config.AbstractMongoConfiguration.mappingMongoConverter()    抛出java.lang.Exception]抛出异常;嵌套异常是java.lang.NoSuchMethodError:    org.springframework.data.util.ClassTypeInformation.from(Ljava /郎/类;)Lorg / springframework的/数据/ util的/ ClassTypeInformation;

我有以下配置     

<mongo:mongo host="127.0.0.1" port="27017" />
<mongo:db-factory dbname="ssss" />

<bean id="mongoTemplate" class="org.springframework.data.mongodb.core.MongoTemplate">
    <constructor-arg name="mongoDbFactory" ref="mongoDbFactory" />
</bean>

和我正在使用                  org.springframework.data             弹簧数据的mongodb             1.7.1.RELEASE         

1 个答案:

答案 0 :(得分:0)

检查类路径中是否有正确的jar。 你需要spring-data-commons-core jar,这是最新版本: http://mvnrepository.com/artifact/org.springframework.data/spring-data-commons-core/1.4.1.RELEASE