what is the best way to dispose
DocumentNodeStore
in a Spring boot application when the server shutdowns?
@Configuration
@Profile("production")
public class MongoRepositoryInitializer {
.
.
.
@Bean
public DocumentNodeStore documentNodeStore(MongoClient mongoClient, MongoBlobStore mongoBlobStore) {
return MongoDocumentNodeStoreBuilder
.newMongoDocumentNodeStoreBuilder().setMongoDB(mongoClient, mongoDbName, 16)
.setBlobStore(mongoBlobStore)
.build();
}
}
where should I call documentNodeStore.dispose()
? is this enough to clean up all mongo related staffs ?