List of usage examples for com.mongodb.connection.netty NettyStreamFactoryFactory NettyStreamFactoryFactory
@Deprecated
public NettyStreamFactoryFactory()
From source file:com.supermy.im.mongo.MongoRepository.java
License:Apache License
@Bean(name = "mongoClient") public MongoClient mongoClient() { System.out.println("*******************" + mongoAddress); ClusterSettings clusterSettings = ClusterSettings.builder() .hosts(Arrays.asList(new ServerAddress(mongoAddress))).build(); MongoCredential credential = MongoCredential.createCredential(mongoUser, mydb, mongoPasswd.toCharArray()); MongoClientSettings settings = MongoClientSettings.builder() .streamFactoryFactory(new NettyStreamFactoryFactory()).clusterSettings(clusterSettings) .credentialList(Arrays.asList(credential)).build(); // MongoClient mongoClient = new MongoClient(new ServerAddress(), Arrays.asList(credential)); MongoClient mongoClient = MongoClients.create(settings); return mongoClient; }