I would like to use fongo 2.0.x in my Spring boot application, but I getting 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
}
}
From the Fongo documentation:
It has a "provided" dependency on the mongo-java-driver and was tested with 2.13.0 and 3.0.1.
So Fongo wants mongo-java-driver
on the classpath, and I'm guessing you don't have it (or at least not in the test
scope).
So make sure the following is in your build script:
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'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With