Just started to check the relevant information on the Internet for some configuration, reference link: http://www.open-open.com/lib/view/open1454374782167.html
MAVEN's dependencies are as follows:
<Dependency> <groupId>Org.springframework</groupId> <Artifactid>Spring-core</Artifactid> <version>4.2.3.RELEASE</version> <Exclusions> <exclusion> <groupId>Commons-logging</groupId> <Artifactid>Commons-logging</Artifactid> </exclusion> </Exclusions> <type>Jar</type> <Scope>Compile</Scope></Dependency><Dependency> <groupId>Org.springframework.data</groupId> <Artifactid>Spring-data-mongodb</Artifactid> <version>1.8.2.RELEASE</version></Dependency>
Spring-mongo.xml
<Beansxmlns= "Http://www.springframework.org/schema/beans"Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"xmlns:p= "http://www.springframework.org/schema/p"Xmlns:mongo= "Http://www.springframework.org/schema/data/mongo"Xmlns:context= "Http://www.springframework.org/schema/context"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/repository http://www.springframework.org/schema/data /repository/spring-repository-1.5.xsd Http://www.springframework.org/schema/data/mongo HTTP://WWW.SP Ringframework.org/schema/data/mongo/spring-mongo-1.5.xsd Http://www.springframework.org/schema/context Http://www.springframework.org/schema/context/spring-context.xsd "><mongo:db-factoryID= "Mongodbfactory"Host= "127.0.0.1"Port= "27017"dbname= "Webusi" /><BeanID= "Mongotemplate"class= "Org.springframework.data.mongodb.core.MongoTemplate"> <Constructor-argname= "Mongodbfactory"ref= "Mongodbfactory" /> </Bean> </Beans>
After testing has been prompted, Mongotemplate created times wrong:
class [Org.springframework.data.mongodb.core.MongoTemplate]: Constructor threw exception; Nested exception is Java.lang.NoSuchMethodError
Later re-adjusted the version of Spring-core to 4.1.3.RELEASE, OK, is it really incompatible with the issue of version??
Again, the Spring-core version is adjusted to 4.0.6, incredibly not an error, really weird ...
Spring Integrated MONGODB report nosuchmethoderror error