I am working on a spring boot project with JaVers integrated along with spring-boot-starter-data-mongodb.
I had to configure MongoClient for some encryption settings for which I need to explicitly create it as a Bean. The newer version of mongo java driver (since version 3.7) recommends that the MongoClient is created using MongoClients class which creates an instance of com.mongodb.client.MongoClient (source). When this happens, the application produces an error as JaVers is expecting a legacy version of MongoClient.
Field mongoClient in org.javers.spring.boot.mongo.JaversMongoAutoConfiguration required a bean of type 'com.mongodb.MongoClient' that could not be found.
The injection point has the following annotations:
- @org.springframework.beans.factory.annotation.Autowired(required=true)
The following candidates were found but could not be injected:
- Bean method 'mongo' in 'MongoAutoConfiguration' not loaded because @ConditionalOnMissingBean (types: com.mongodb.MongoClient,com.mongodb.client.MongoClient; SearchStrategy: all) found beans of type 'com.mongodb.client.MongoClient' mongoClient
Action:
Consider revisiting the entries above or defining a bean of type 'com.mongodb.MongoClient' in your configuration.
This forces me to stay with the legacy MongoClient that doesn't have a nice builder to accept various settings.
I am working on a spring boot project with JaVers integrated along with
spring-boot-starter-data-mongodb.I had to configure
MongoClientfor some encryption settings for which I need to explicitly create it as a Bean. The newer version of mongo java driver (since version 3.7) recommends that theMongoClientis created usingMongoClientsclass which creates an instance ofcom.mongodb.client.MongoClient(source). When this happens, the application produces an error as JaVers is expecting a legacy version of MongoClient.This forces me to stay with the legacy MongoClient that doesn't have a nice builder to accept various settings.