imported MongoOptionsFactory from cnr-mongo-mdstore
This commit is contained in:
parent
14a4a544e7
commit
213d3b3012
|
@ -0,0 +1,33 @@
|
|||
package eu.dnetlib.mongodb;
|
||||
|
||||
import com.mongodb.MongoClientOptions;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
|
||||
public class MongoOptionsFactory implements FactoryBean<MongoClientOptions> {
|
||||
private int connectionsPerHost;
|
||||
|
||||
@Override
|
||||
public MongoClientOptions getObject() throws BeansException {
|
||||
return MongoClientOptions.builder().connectionsPerHost(connectionsPerHost).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<MongoClientOptions> getObjectType() {
|
||||
return MongoClientOptions.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingleton() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getConnectionsPerHost() {
|
||||
return connectionsPerHost;
|
||||
}
|
||||
|
||||
public void setConnectionsPerHost(int connectionsPerHost) {
|
||||
this.connectionsPerHost = connectionsPerHost;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue