Fongo - OperationExecutor not found

I would like to use fongo 2.0.x in my Spring boot application, but I get errror

Error:(23, 44) java: cannot access com.mongodb.operation.OperationExecutor
class file for com.mongodb.operation.OperationExecutor not found

Here is my AbstractMongoConfiguration

@Configuration
@ComponentScan("com.foo")
public class MongoDbConfig extends AbstractMongoConfiguration {

    @Override
    protected String getDatabaseName() {
        return "demo";
    }

    @Override
    public Mongo mongo() throws Exception {
        return new Fongo(getDatabaseName()).getMongo(); //this line throws the error
    }
}
+4
source share
1 answer

From the Fongo Documentation :

It has a “provided” dependency on the mongo-java driver and has been tested with 2.13.0 and 3.0.1.

So, Fongo wants mongo-java-driveron the way to classes, and I guess you don't have one (or at least not in scope test).

So make sure your build script says the following:

For Maven:

<dependency>
  <groupId>org.mongodb</groupId>
  <artifactId>mongo-java-driver</artifactId>
  <version>3.4.1</version>
  <scope>test</scope>
</dependency>

For Gradle:

testCompile 'org.mongodb:mongo-java-driver:3.4.1'
+1
source

All Articles