创建名称为'mongoTemplate'的bean时出错

org.springframework.beans.factory.BeanCreationException:在类com.socketcruiter.config.SpringMongoConfig中定义名称为'mongoTemplate'的bean时出错:Bean实例化失败; 嵌套异常是org.springframework.beans.factory.BeanDefinitionStoreException:工厂方法[public org.springframework.data.mongodb.core.MongoTemplate org.springframework.data.mongodb.config.AbstractMongoConfiguration.mongoTemplate()throws java.lang.Exception]抛出异常; 嵌套异常是org.springframework.beans.factory.BeanCreationException:在类com.socketcruiter.config.SpringMongoConfig中定义名称为'mappingMongoConverter'的bean时出错:bean的实例化失败; 嵌套异常是org.springframework.beans.factory.BeanDefinitionStoreException:工厂方法[public org.springframework.data.mongodb.core.convert.MappingMongoConverter org.springframework.data.mongodb.config.AbstractMongoConfiguration.mappingMongoConverter()throws java.lang。例外]抛出异常; 嵌套异常是java.lang.NoSuchMethodError:org.springframework.data.util.ClassTypeInformation.from(Ljava / lang / Class;)Lorg / springframework / data / 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 spring-data-mongodb 1.7.1.RELEASE


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

链接地址: http://www.djcxy.com/p/68771.html

上一篇: Error creating bean with name 'mongoTemplate'

下一篇: Spring MVC can't run on linux(CentOS)