Caused by: java.lang.NoSuchMethodError: org.springframework.data.mongodb.core.MongoTemplate.<init>(Lcom/mongodb/Mongo;Ljava/lang/String;)V
Looks like jar is corrupted or missing, check all spring related jar are 4.x or higher versionif that doent work then:
Mongobee depends on Spring 4.x jars which may conflicts with Spring boot 2.x
try the below way
@Bean public Mongobee mongobee(){ Mongobee mongobee = new Mongobee("mongodb://localhost:27017/seed"); mongobee.setChangeLogsScanPackage(InitialData.class.getPackageName()); mongobee.setMongoTemplate(template); return mongobee; }
You need change Mongobee by Mongock if you use Springboot 2. The syntax is almost the same because the Mongock project is the continuation of the Mongobee project.
Springboot:
@Beanpublic SpringBootMongock mongock(ApplicationContext springContext, MongoClient mongoClient) { return (SpringBootMongock) new SpringBootMongockBuilder(mongoClient, "yourDbName", "com.package.to.be.scanned.for.changesets") .setApplicationContext(springContext) .setLockQuickConfig() .build();}
Spring:
@Beanpublic SpringMongock mongock() { MongoClient mongoclient = new MongoClient(new MongoClientURI("yourDbName", yourMongoClientBuilder)); return new SpringMongockBuilder(mongoclient, "yourDbName", "com.package.to.be.scanned.for.changesets") .setLockQuickConfig() .build();}