Allow access to mongoDatabaseFactory used in ReactiveMongoTemplate.
By offering a getter method for the ReactiveMongoDatabaseFactory users subclassing ReactiveMongoTemplate could evaluate the current transaction state via ReactiveMongoDatabaseUtils.isTransactionActive(getDatabaseFactory()). This change also aligns the reactive and imperative template implementation in that regard. Closes #3540 Original pull request: #3541.
This commit is contained in:
committed by
Mark Paluch
parent
7429503c63
commit
02eaa4cbd2
@@ -28,7 +28,6 @@ import org.bson.Document;
|
|||||||
import org.bson.conversions.Bson;
|
import org.bson.conversions.Bson;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import org.springframework.beans.BeansException;
|
import org.springframework.beans.BeansException;
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
import org.springframework.context.ApplicationContextAware;
|
import org.springframework.context.ApplicationContextAware;
|
||||||
@@ -3454,7 +3453,20 @@ public class MongoTemplate implements MongoOperations, ApplicationContextAware,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated since 3.1.4. Use {@link #getMongoDatabaseFactory()} instead.
|
||||||
|
* @return the {@link MongoDatabaseFactory} in use.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public MongoDatabaseFactory getMongoDbFactory() {
|
public MongoDatabaseFactory getMongoDbFactory() {
|
||||||
|
return getMongoDatabaseFactory();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the {@link MongoDatabaseFactory} in use.
|
||||||
|
* @since 3.1.4
|
||||||
|
*/
|
||||||
|
public MongoDatabaseFactory getMongoDatabaseFactory() {
|
||||||
return mongoDbFactory;
|
return mongoDbFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2730,6 +2730,14 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati
|
|||||||
return potentiallyForceAcknowledgedWrite(wc);
|
return potentiallyForceAcknowledgedWrite(wc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the {@link MongoDatabaseFactory} in use.
|
||||||
|
* @since 3.1.4
|
||||||
|
*/
|
||||||
|
public ReactiveMongoDatabaseFactory getMongoDatabaseFactory() {
|
||||||
|
return mongoDatabaseFactory;
|
||||||
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private WriteConcern potentiallyForceAcknowledgedWrite(@Nullable WriteConcern wc) {
|
private WriteConcern potentiallyForceAcknowledgedWrite(@Nullable WriteConcern wc) {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user