/** * Creates a new {@link SimpleMongoClientDbFactory} instance for the given {@code connectionString}. * * @param connectionString connection coordinates for a database connection. Must contain a database name and must not * be {@literal null} or empty. * @see <a href="https://docs.mongodb.com/manual/reference/connection-string/">MongoDB Connection String reference</a> */ public SimpleMongoClientDbFactory(String connectionString) { this(new ConnectionString(connectionString)); }
/** * Create a new client with the given connection string as if by a call to {@link #create(ConnectionString)}. * * @param connectionString the connection * @return the client * @see #create(ConnectionString) */ public static MongoClient create(final String connectionString) { return create(new ConnectionString(connectionString)); }
/** * Creates a new client with the default connection string "mongodb://localhost". * * @return the client */ public static MongoClient create() { return create(new ConnectionString("mongodb://localhost")); }
/** * Creates a MongoURI from the given URI string, and MongoClientOptions.Builder. The builder can be configured with default options, * which may be overridden by options specified in the URI string. * * <p> * The {@code MongoClientURI} takes ownership of the {@code MongoClientOptions.Builder} instance that is passed to this constructor, * and may modify it. * </p> * * @param uri the URI * @param builder a non-null Builder, which may be modified within this constructor, * @since 2.11.0 */ public MongoClientURI(final String uri, final MongoClientOptions.Builder builder) { this.builder = notNull("builder", builder); proxied = new ConnectionString(uri); }
public void configure(final Env env, final Config conf, final Binder binder) { ConnectionString cstr = Try.apply(() -> new ConnectionString(db)) .orElseGet(() -> new ConnectionString(conf.getString(db)));
/** * Creates a new {@link SimpleMongoClientDbFactory} instance for the given {@code connectionString}. * * @param connectionString connection coordinates for a database connection. Must contain a database name and must not * be {@literal null} or empty. * @see <a href="https://docs.mongodb.com/manual/reference/connection-string/">MongoDB Connection String reference</a> */ public SimpleMongoClientDbFactory(String connectionString) { this(new ConnectionString(connectionString)); }
@Bean ConnectionString mongoConnectionString(@Value("${spring.datasource.url:mongodb://localhost:27017/piper}") URI datasourceURI) { return new ConnectionString(datasourceURI.toString()); }
/** * Create a new client with the given connection string. * * @param connectionString the connection * @return the client */ public static MongoClient create(final String connectionString) { return create(new ConnectionString(connectionString)); }
/** * Creates a new client with the default connection string "mongodb://localhost". * * @return the client */ public static MongoClient create() { return create(new ConnectionString("mongodb://localhost")); }
/** * Creates a new client with the default connection string "mongodb://localhost". * * @return the client */ public static MongoClient create() { return create(new ConnectionString("mongodb://localhost")); }
/** * Create a new client with the given connection string as if by a call to {@link #create(ConnectionString)}. * * @param connectionString the connection * @return the client * @see #create(ConnectionString) */ public static MongoClient create(final String connectionString) { return create(new ConnectionString(connectionString)); }
/** * Create a new client with the given connection string as if by a call to {@link #create(ConnectionString)}. * * @param connectionString the connection * @return the client * @see #create(ConnectionString) */ public static MongoClient create(final String connectionString) { return create(new ConnectionString(connectionString)); }
/** * Creates a new client with the default connection string "mongodb://localhost". * * @return the client */ public static MongoClient create() { return create(new ConnectionString("mongodb://localhost")); }
/** * Creates a MongoURI from the given URI string, and MongoClientOptions.Builder. The builder can be configured with default options, * which may be overridden by options specified in the URI string. * * <p> * The {@code MongoClientURI} takes ownership of the {@code MongoClientOptions.Builder} instance that is passed to this constructor, * and may modify it. * </p> * * @param uri the URI * @param builder a non-null Builder, which may be modified within this constructor, * @since 2.11.0 */ public MongoClientURI(final String uri, final MongoClientOptions.Builder builder) { this.builder = notNull("builder", builder); proxied = new ConnectionString(uri); }
public void configure(final Env env, final Config conf, final Binder binder) { ConnectionString cstr = Try.apply(() -> new ConnectionString(db)) .orElseGet(() -> new ConnectionString(conf.getString(db)));
.applyConnectionString(new ConnectionString(uri)) .build();
final boolean jmxListenerEnabled = MongoConfig.getJmxListenerEnabled(config); final String uri = MongoConfig.getMongoUri(config); final ConnectionString connectionString = new ConnectionString(uri); final String database = connectionString.getDatabase();
final boolean jmxListenerEnabled = MongoConfig.getJmxListenerEnabled(config); final String uri = MongoConfig.getMongoUri(config); final ConnectionString connectionString = new ConnectionString(uri); final String database = connectionString.getDatabase();