title: Embedded mongodb to spring-boot application java exception
body: <p>I need to set embedded mongodb in my springboot project but it show infinite error logs. Someone can help me?
  I use these dependencies</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!-- https://mvnrepository.com/artifact/de.flapdoodle.embed/de.flapdoodle.embed.mongo --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;de.flapdoodle.embed&lt;/groupId&gt;
              &lt;artifactId&gt;de.flapdoodle.embed.mongo&lt;/artifactId&gt;
              &lt;version&gt;2.2.0&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- https://mvnrepository.com/artifact/cz.jirutka.spring/embedmongo-spring --&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.mongodb&lt;/groupId&gt;
              &lt;artifactId&gt;bson&lt;/artifactId&gt;
              &lt;version&gt;3.8.0&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.mongodb&lt;/groupId&gt;
              &lt;artifactId&gt;mongodb-driver&lt;/artifactId&gt;
              &lt;version&gt;3.8.0&lt;/version&gt;
              &lt;exclusions&gt;
                  &lt;exclusion&gt;
                      &lt;groupId&gt;org.mongodb&lt;/groupId&gt; &lt;!-- Exclude Project-E from Project-B --&gt;
                      &lt;artifactId&gt;bson&lt;/artifactId&gt;
                  &lt;/exclusion&gt;
              &lt;/exclusions&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.mongodb&lt;/groupId&gt;
              &lt;artifactId&gt;mongodb-driver-core&lt;/artifactId&gt;
              &lt;version&gt;3.8.0&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;cz.jirutka.spring&lt;/groupId&gt;
              &lt;artifactId&gt;embedmongo-spring&lt;/artifactId&gt;
              &lt;version&gt;1.3.1&lt;/version&gt;
          &lt;/dependency&gt;</code></pre>
  </div>
  </div>
  </p>
  <p>And then i configure the mongoTemplate with this method in a configuration class</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>     private static final String MONGO_DB_URL = "localhost";
          private static final String MONGO_DB_NAME = "embedded_db";
  
          @Bean
          public MongoTemplate mongoTemplate() throws IOException {
              EmbeddedMongoFactoryBean mongo = new EmbeddedMongoFactoryBean();
              mongo.setBindIp(MONGO_DB_URL);
              MongoClient mongoClient = (MongoClient) mongo.getObject();
              return new MongoTemplate(mongoClient, MONGO_DB_NAME);
          }</code></pre>
  </div>
  </div>
  </p>
  <p>But when i run my application it show this error+</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>Exception in thread "main" 11:56:00.710 [Thread-0] DEBUG de.flapdoodle.embed.process.store.CachingArtifactStore - force delete for PRODUCTION:Windows:B64 and de.flapdoodle.embed.process.extract.ImmutableExtractedFileSet@545997b1
  11:56:00.710 [Thread-1] DEBUG de.flapdoodle.embed.mongo.AbstractMongoProcess - try to stop mongod
  java.lang.NoSuchMethodError: 'void com.mongodb.client.internal.MongoClientDelegate.&lt;init&gt;(com.mongodb.connection.Cluster, java.util.List, java.lang.Object)'
      at com.mongodb.Mongo.&lt;init&gt;(Mongo.java:319)
      at com.mongodb.Mongo.&lt;init&gt;(Mongo.java:291)
      at com.mongodb.Mongo.&lt;init&gt;(Mongo.java:286)
      at com.mongodb.Mongo.&lt;init&gt;(Mongo.java:282)
      at com.mongodb.MongoClient.&lt;init&gt;(MongoClient.java:180)
      at com.mongodb.MongoClient.&lt;init&gt;(MongoClient.java:155)
      at com.mongodb.MongoClient.&lt;init&gt;(MongoClient.java:145)
      at cz.jirutka.spring.embedmongo.EmbeddedMongoBuilder.build(EmbeddedMongoBuilder.java:104)
      at cz.jirutka.spring.embedmongo.EmbeddedMongoFactoryBean.getObject(EmbeddedMongoFactoryBean.java:52)
      at com.nextage.arcacrmconnector.commons.EmbeddedMongoDb.mongoTemplate(EmbeddedMongoDb.java:20)
      at com.nextage.arcacrmconnector.commons.MongoTemplateSingleton.setMongoTemplate(MongoTemplateSingleton.java:20)
      at com.nextage.arcacrmconnector.commons.MongoTemplateSingleton.getMongoTemplate(MongoTemplateSingleton.java:13)
      at com.nextage.arcacrmconnector.services.CommonMongoService.&lt;init&gt;(CommonMongoService.java:12)
      at com.nextage.arcacrmconnector.services.LogService.&lt;init&gt;(LogService.java:18)
      at com.nextage.arcacrmconnector.consumer.QueueConsumerTimerTask.&lt;init&gt;(QueueConsumerTimerTask.java:23)
      at com.nextage.arcacrmconnector.application.Application.&lt;clinit&gt;(Application.java:30)
  11:56:00.716 [Thread-0] WARN de.flapdoodle.embed.process.io.file.Files - could not delete C:\Users\DONATE~1\AppData\Local\Temp\extract-70ac2cd1-bb5b-4276-9243-cdf6b52db3famongod.exe. Will try to delete it again when program exits.
  Exception in thread "Thread-0" java.lang.IllegalStateException: Shutdown in progress
      at java.base/java.lang.ApplicationShutdownHooks.add(ApplicationShutdownHooks.java:66)
      at java.base/java.lang.Runtime.addShutdownHook(Runtime.java:213)
      at de.flapdoodle.embed.process.io.file.FileCleaner.forceDeleteOnExit(FileCleaner.java:51)
      at de.flapdoodle.embed.process.io.file.Files.forceDelete(Files.java:128)
      at de.flapdoodle.embed.process.extract.ExtractedFileSets.delete(ExtractedFileSets.java:77)
      at de.flapdoodle.embed.process.store.ArtifactStore.removeFileSet(ArtifactStore.java:90)
      at de.flapdoodle.embed.process.store.CachingArtifactStore$FilesWithCounter.forceDelete(CachingArtifactStore.java:176)
      at de.flapdoodle.embed.process.store.CachingArtifactStore.removeAll(CachingArtifactStore.java:100)
      at de.flapdoodle.embed.process.store.CachingArtifactStore$CacheCleaner.run(CachingArtifactStore.java:196)
      at java.base/java.lang.Thread.run(Thread.java:830)</code></pre>
  </div>
  </div>
  </p>
  <p>How can i fix it? It is a dependency version error?</p>