Example usage for org.springframework.data.mongodb.core MongoClientFactoryBean setPort

List of usage examples for org.springframework.data.mongodb.core MongoClientFactoryBean setPort

Introduction

In this page you can find the example usage for org.springframework.data.mongodb.core MongoClientFactoryBean setPort.

Prototype

public void setPort(int port) 

Source Link

Document

Configures the port to connect to.

Usage

From source file:com.card.loop.xyz.config.AppConfig.java

@Bean
public Mongo mongo() throws Exception {
    MongoClientFactoryBean mongo = new MongoClientFactoryBean();
    mongo.setSingleton(false);/*from   w  w  w .j  a  va  2s  . co  m*/
    mongo.setHost(mongodb_host);
    mongo.setPort(mongodb_port);
    Builder builder = MongoClientOptions.builder();
    builder.connectionsPerHost(AppConfig.connectionsPerHost);
    builder.connectTimeout(AppConfig.connectionTimeOut);
    return mongo.getObject();
}