Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>org.springframework.data</groupId>
<artifactId>spring-data-mongodb-parent</artifactId>
<version>2.0.0.BUILD-SNAPSHOT</version>
<version>2.0.0.DATAMONGO-1631-SNAPSHOT</version>
<packaging>pom</packaging>

<name>Spring Data MongoDB</name>
Expand Down
2 changes: 1 addition & 1 deletion spring-data-mongodb-benchmarks/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-mongodb-parent</artifactId>
<version>2.0.0.BUILD-SNAPSHOT</version>
<version>2.0.0.DATAMONGO-1631-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
4 changes: 2 additions & 2 deletions spring-data-mongodb-cross-store/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-mongodb-parent</artifactId>
<version>2.0.0.BUILD-SNAPSHOT</version>
<version>2.0.0.DATAMONGO-1631-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down Expand Up @@ -48,7 +48,7 @@
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-mongodb</artifactId>
<version>2.0.0.BUILD-SNAPSHOT</version>
<version>2.0.0.DATAMONGO-1631-SNAPSHOT</version>
</dependency>

<!-- reactive -->
Expand Down
2 changes: 1 addition & 1 deletion spring-data-mongodb-distribution/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<parent>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-mongodb-parent</artifactId>
<version>2.0.0.BUILD-SNAPSHOT</version>
<version>2.0.0.DATAMONGO-1631-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion spring-data-mongodb/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<parent>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-mongodb-parent</artifactId>
<version>2.0.0.BUILD-SNAPSHOT</version>
<version>2.0.0.DATAMONGO-1631-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -13,17 +13,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.springframework.data.mongodb.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.mongodb.ReactiveMongoDatabaseFactory;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.ReactiveMongoOperations;
import org.springframework.data.mongodb.core.SimpleReactiveMongoDatabaseFactory;
import org.springframework.data.mongodb.core.ReactiveMongoTemplate;
import org.springframework.data.mongodb.core.SimpleMongoDbFactory;
import org.springframework.data.mongodb.core.SimpleReactiveMongoDatabaseFactory;
import org.springframework.data.mongodb.core.convert.MappingMongoConverter;

import com.mongodb.reactivestreams.client.MongoClient;
Expand All @@ -39,12 +38,12 @@
public abstract class AbstractReactiveMongoConfiguration extends MongoConfigurationSupport {

/**
* Return the {@link MongoClient} instance to connect to. Annotate with {@link Bean} in case you want to expose a
* Return the Reactive Streams {@link MongoClient} instance to connect to. Annotate with {@link Bean} in case you want to expose a
* {@link MongoClient} instance to the {@link org.springframework.context.ApplicationContext}.
*
* @return
*/
public abstract MongoClient mongoClient();
public abstract MongoClient reactiveMongoClient();

/**
* Creates a {@link ReactiveMongoTemplate}.
Expand All @@ -53,30 +52,29 @@ public abstract class AbstractReactiveMongoConfiguration extends MongoConfigurat
*/
@Bean
public ReactiveMongoOperations reactiveMongoTemplate() throws Exception {
return new ReactiveMongoTemplate(mongoDbFactory(), mappingMongoConverter());
return new ReactiveMongoTemplate(reactiveMongoDbFactory(), mappingMongoConverter());
}

/**
* Creates a {@link SimpleMongoDbFactory} to be used by the {@link MongoTemplate}. Will use the {@link Mongo} instance
* configured in {@link #mongoClient()}.
* configured in {@link #reactiveMongoClient()}.
*
* @see #mongoClient()
* @see #reactiveMongoClient()
* @see #reactiveMongoTemplate()
* @return
* @throws Exception
*/
@Bean
public ReactiveMongoDatabaseFactory mongoDbFactory() {
return new SimpleReactiveMongoDatabaseFactory(mongoClient(), getDatabaseName());
public ReactiveMongoDatabaseFactory reactiveMongoDbFactory() {
return new SimpleReactiveMongoDatabaseFactory(reactiveMongoClient(), getDatabaseName());
}

/**
* Creates a {@link MappingMongoConverter} using the configured {@link #mongoDbFactory()} and
* Creates a {@link MappingMongoConverter} using the configured {@link #reactiveMongoDbFactory()} and
* {@link #mongoMappingContext()}. Will get {@link #customConversions()} applied.
*
* @see #customConversions()
* @see #mongoMappingContext()
* @see #mongoDbFactory()
* @see #reactiveMongoDbFactory()
* @return
* @throws Exception
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void contextShouldContainTemplate() {
static class ReactiveConfiguration extends AbstractReactiveMongoConfiguration {

@Override
public MongoClient mongoClient() {
public MongoClient reactiveMongoClient() {
return MongoClients.create();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.springframework.data.mongodb.config;

import static org.hamcrest.Matchers.*;
Expand Down Expand Up @@ -158,7 +157,7 @@ protected String getDatabaseName() {
}

@Override
public MongoClient mongoClient() {
public MongoClient reactiveMongoClient() {
return MongoClients.create();
}

Expand Down Expand Up @@ -186,7 +185,7 @@ protected String getDatabaseName() {
}

@Override
public MongoClient mongoClient() {
public MongoClient reactiveMongoClient() {
return MongoClients.create();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public class DefaultReactiveIndexOperationsTests {
static class Config extends AbstractReactiveMongoConfiguration {

@Override
public MongoClient mongoClient() {
public MongoClient reactiveMongoClient() {
return MongoClients.create();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public class ReactiveMongoTemplateCollationTests {
static class Config extends AbstractReactiveMongoConfiguration {

@Override
public com.mongodb.reactivestreams.client.MongoClient mongoClient() {
public com.mongodb.reactivestreams.client.MongoClient reactiveMongoClient() {
return MongoClients.create();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class ApplicationConfig extends AbstractReactiveMongoConfiguration {
}

@Override
public MongoClient mongoClient() {
public MongoClient reactiveMongoClient() {
return MongoClients.create();
}

Expand Down
14 changes: 7 additions & 7 deletions src/main/asciidoc/reference/reactive-mongodb.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public class AppConfig {
/*
* Use the Reactive Streams Mongo Client API to create a com.mongodb.reactivestreams.client.MongoClient instance.
*/
public @Bean MongoClient mongoClient() {
public @Bean MongoClient reactiveMongoClient() {
return MongoClients.create("mongodb://localhost");
}
}
Expand Down Expand Up @@ -262,7 +262,7 @@ To register a `ReactiveMongoDatabaseFactory` instance with the container, you wr
@Configuration
public class MongoConfiguration {

public @Bean ReactiveMongoDatabaseFactory mongoDatabaseFactory() {
public @Bean ReactiveMongoDatabaseFactory reactiveMongoDatabaseFactory() {
return new SimpleReactiveMongoDatabaseFactory(MongoClients.create(), "database");
}
}
Expand All @@ -275,12 +275,12 @@ To define the username and password create MongoDB connection string and pass it
@Configuration
public class MongoConfiguration {

public @Bean ReactiveMongoDatabaseFactory mongoDatabaseFactory() {
return new SimpleMongoDbFactory(MongoClients.create("mongodb://joe:secret@localhost"), "database", userCredentials);
public @Bean ReactiveMongoDatabaseFactory reactiveMongoDatabaseFactory() {
return new SimpleReactiveMongoDatabaseFactory(MongoClients.create("mongodb://joe:secret@localhost"), "database");
}

public @Bean ReactiveMongoTemplate reactiveMongoTemplate() {
return new ReactiveMongoTemplate(mongoDatabaseFactory());
return new ReactiveMongoTemplate(reactiveMongoDatabaseFactory());
}
}
----
Expand Down Expand Up @@ -318,12 +318,12 @@ You can use Java to create and register an instance of `ReactiveMongoTemplate` a
@Configuration
public class AppConfig {

public @Bean MongoClient mongoClient() {
public @Bean MongoClient reactiveMongoClient() {
return MongoClients.create("mongodb://localhost");
}

public @Bean ReactiveMongoTemplate reactiveMongoTemplate() {
return new ReactiveMongoTemplate(mongoClient(), "mydatabase");
return new ReactiveMongoTemplate(reactiveMongoClient(), "mydatabase");
}
}
----
Expand Down