List of usage examples for com.mongodb ConnectionString getCredentialList
@Deprecated
public List<MongoCredential> getCredentialList()
From source file:org.openo.commontosca.inventory.core.mongo.MongoInventoryProvider.java
License:Apache License
public static MongoClient create(final String url) { ConnectionString connectionString = new ConnectionString(url); Builder builder = MongoClientSettings.builder(); builder.clusterSettings(ClusterSettings.builder().applyConnectionString(connectionString).build()); builder.connectionPoolSettings(/*from w w w . j av a 2s .c o m*/ ConnectionPoolSettings.builder().applyConnectionString(connectionString).build()); builder.serverSettings(ServerSettings.builder().build()); builder.credentialList(connectionString.getCredentialList()); builder.sslSettings(SslSettings.builder().applyConnectionString(connectionString).build()); builder.socketSettings(SocketSettings.builder().applyConnectionString(connectionString).build()); builder.codecRegistry( CodecRegistries.fromRegistries(MongoClients.getDefaultCodecRegistry(), new ObjectCodecRegistry())); // builder.streamFactoryFactory(new NettyStreamFactoryFactory()); return MongoClients.create(builder.build()); }