Skip to content

Commit cfaabe2

Browse files
artembilangaryrussell
authored andcommitted
Revert MongoDb driver 4 changes
* Bring Spring Data MongoDb back to `2.3`; essentially rely on Spring Data BOM for dependencies * Change `mongodb-driver-reactivestreams` driver version back to `1.12.0` * Upgrade to Spring Security 5.3 M1 * Fix MongoDb module to use `MongoDbFactory` class instead of new (not committed yet) `MongoDatabaseFactory` * Remove `uuidRepresentation()` configuration from the `MongoClients` factory usage - that is going to be MongoDb driver 4 feature
1 parent be9d735 commit cfaabe2

25 files changed

+123
-130
lines changed

build.gradle

+3-4
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ ext {
8181
log4jVersion = '2.13.0'
8282
micrometerVersion = '1.3.2'
8383
mockitoVersion = '3.2.4'
84-
mongoDriverVersion = '4.0.0-SNAPSHOT'
84+
mongoDriverVersion = '1.12.0'
8585
mysqlVersion = '8.0.18'
8686
pahoMqttClientVersion = '1.2.0'
8787
postgresVersion = '42.2.9'
@@ -93,7 +93,7 @@ ext {
9393
smackVersion = '4.3.4'
9494
springAmqpVersion = project.hasProperty('springAmqpVersion') ? project.springAmqpVersion : '2.2.3.BUILD-SNAPSHOT'
9595
springDataVersion = project.hasProperty('springDataVersion') ? project.springDataVersion : 'Neumann-BUILD-SNAPSHOT'
96-
springSecurityVersion = project.hasProperty('springSecurityVersion') ? project.springSecurityVersion : '5.3.0.BUILD-SNAPSHOT'
96+
springSecurityVersion = project.hasProperty('springSecurityVersion') ? project.springSecurityVersion : '5.3.0.M1'
9797
springRetryVersion = '1.2.5.RELEASE'
9898
springVersion = project.hasProperty('springVersion') ? project.springVersion : '5.2.3.BUILD-SNAPSHOT'
9999
springWsVersion = '3.0.8.RELEASE'
@@ -591,11 +591,10 @@ project('spring-integration-mongodb') {
591591
description = 'Spring Integration MongoDB Support'
592592
dependencies {
593593
api project(':spring-integration-core')
594-
api ('org.springframework.data:spring-data-mongodb:3.0.0.BUILD-SNAPSHOT') {
594+
api ('org.springframework.data:spring-data-mongodb') {
595595
exclude group: 'org.springframework'
596596
}
597597
optionalApi "org.mongodb:mongodb-driver-reactivestreams:$mongoDriverVersion"
598-
optionalApi "org.mongodb:mongodb-driver-sync:$mongoDriverVersion"
599598
}
600599
}
601600

spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/dsl/MongoDb.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2019 the original author or authors.
2+
* Copyright 2016-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -16,7 +16,7 @@
1616

1717
package org.springframework.integration.mongodb.dsl;
1818

19-
import org.springframework.data.mongodb.MongoDatabaseFactory;
19+
import org.springframework.data.mongodb.MongoDbFactory;
2020
import org.springframework.data.mongodb.core.MongoOperations;
2121
import org.springframework.data.mongodb.core.convert.MongoConverter;
2222

@@ -31,13 +31,13 @@ public final class MongoDb {
3131

3232
/**
3333
* Create a {@link MongoDbOutboundGatewaySpec} builder instance
34-
* based on the provided {@link MongoDatabaseFactory} and {@link MongoConverter}.
35-
* @param mongoDbFactory the {@link MongoDatabaseFactory} to use.
34+
* based on the provided {@link MongoDbFactory} and {@link MongoConverter}.
35+
* @param mongoDbFactory the {@link MongoDbFactory} to use.
3636
* @param mongoConverter the {@link MongoConverter} to use.
3737
* @return the {@link MongoDbOutboundGatewaySpec} instance
3838
*/
3939
public static MongoDbOutboundGatewaySpec outboundGateway(
40-
MongoDatabaseFactory mongoDbFactory, MongoConverter mongoConverter) {
40+
MongoDbFactory mongoDbFactory, MongoConverter mongoConverter) {
4141

4242
return new MongoDbOutboundGatewaySpec(mongoDbFactory, mongoConverter);
4343
}

spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/dsl/MongoDbOutboundGatewaySpec.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2019 the original author or authors.
2+
* Copyright 2016-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -18,7 +18,7 @@
1818

1919
import java.util.function.Function;
2020

21-
import org.springframework.data.mongodb.MongoDatabaseFactory;
21+
import org.springframework.data.mongodb.MongoDbFactory;
2222
import org.springframework.data.mongodb.core.MongoOperations;
2323
import org.springframework.data.mongodb.core.convert.MongoConverter;
2424
import org.springframework.data.mongodb.core.query.Query;
@@ -40,7 +40,7 @@
4040
public class MongoDbOutboundGatewaySpec
4141
extends MessageHandlerSpec<MongoDbOutboundGatewaySpec, MongoDbOutboundGateway> {
4242

43-
MongoDbOutboundGatewaySpec(MongoDatabaseFactory mongoDbFactory, MongoConverter mongoConverter) {
43+
MongoDbOutboundGatewaySpec(MongoDbFactory mongoDbFactory, MongoConverter mongoConverter) {
4444
this.target = new MongoDbOutboundGateway(mongoDbFactory, mongoConverter);
4545
this.target.setRequiresReply(true);
4646
}

spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/inbound/MongoDbMessageSource.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2007-2019 the original author or authors.
2+
* Copyright 2007-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -18,7 +18,7 @@
1818

1919
import java.util.List;
2020

21-
import org.springframework.data.mongodb.MongoDatabaseFactory;
21+
import org.springframework.data.mongodb.MongoDbFactory;
2222
import org.springframework.data.mongodb.core.MongoOperations;
2323
import org.springframework.data.mongodb.core.MongoTemplate;
2424
import org.springframework.data.mongodb.core.convert.MongoConverter;
@@ -75,7 +75,7 @@ public class MongoDbMessageSource extends AbstractMessageSource<Object> {
7575

7676
private volatile MongoConverter mongoConverter;
7777

78-
private volatile MongoDatabaseFactory mongoDbFactory;
78+
private volatile MongoDbFactory mongoDbFactory;
7979

8080
private volatile boolean initialized = false;
8181

@@ -84,14 +84,14 @@ public class MongoDbMessageSource extends AbstractMessageSource<Object> {
8484
private volatile boolean expectSingleResult = false;
8585

8686
/**
87-
* Creates an instance with the provided {@link MongoDatabaseFactory} and SpEL expression
87+
* Creates an instance with the provided {@link MongoDbFactory} and SpEL expression
8888
* which should resolve to a MongoDb 'query' string
8989
* (see https://www.mongodb.org/display/DOCS/Querying).
9090
* The 'queryExpression' will be evaluated on every call to the {@link #receive()} method.
9191
* @param mongoDbFactory The mongodb factory.
9292
* @param queryExpression The query expression.
9393
*/
94-
public MongoDbMessageSource(MongoDatabaseFactory mongoDbFactory, Expression queryExpression) {
94+
public MongoDbMessageSource(MongoDbFactory mongoDbFactory, Expression queryExpression) {
9595
Assert.notNull(mongoDbFactory, "'mongoDbFactory' must not be null");
9696
Assert.notNull(queryExpression, "'queryExpression' must not be null");
9797

@@ -156,7 +156,7 @@ public void setCollectionNameExpression(Expression collectionNameExpression) {
156156
/**
157157
* Allows you to provide a custom {@link MongoConverter} used to assist in deserialization
158158
* data read from MongoDb. Only allowed if this instance was constructed with a
159-
* {@link MongoDatabaseFactory}.
159+
* {@link MongoDbFactory}.
160160
* @param mongoConverter The mongo converter.
161161
*/
162162
public void setMongoConverter(MongoConverter mongoConverter) {

spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/metadata/MongoDbMetadataStore.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2015-2019 the original author or authors.
2+
* Copyright 2015-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -21,7 +21,7 @@
2121

2222
import org.bson.Document;
2323

24-
import org.springframework.data.mongodb.MongoDatabaseFactory;
24+
import org.springframework.data.mongodb.MongoDbFactory;
2525
import org.springframework.data.mongodb.core.FindAndModifyOptions;
2626
import org.springframework.data.mongodb.core.MongoTemplate;
2727
import org.springframework.data.mongodb.core.query.Criteria;
@@ -58,21 +58,21 @@ public class MongoDbMetadataStore implements ConcurrentMetadataStore {
5858
private final String collectionName;
5959

6060
/**
61-
* Configure the MongoDbMetadataStore by provided {@link MongoDatabaseFactory} and
61+
* Configure the MongoDbMetadataStore by provided {@link MongoDbFactory} and
6262
* default collection name - {@link #DEFAULT_COLLECTION_NAME}.
6363
* @param factory the mongodb factory
6464
*/
65-
public MongoDbMetadataStore(MongoDatabaseFactory factory) {
65+
public MongoDbMetadataStore(MongoDbFactory factory) {
6666
this(factory, DEFAULT_COLLECTION_NAME);
6767
}
6868

6969
/**
70-
* Configure the MongoDbMetadataStore by provided {@link MongoDatabaseFactory} and
70+
* Configure the MongoDbMetadataStore by provided {@link MongoDbFactory} and
7171
* collection name
7272
* @param factory the mongodb factory
7373
* @param collectionName the collection name where it persists the data
7474
*/
75-
public MongoDbMetadataStore(MongoDatabaseFactory factory, String collectionName) {
75+
public MongoDbMetadataStore(MongoDbFactory factory, String collectionName) {
7676
this(new MongoTemplate(factory), collectionName);
7777
}
7878

spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/outbound/MongoDbOutboundGateway.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2019 the original author or authors.
2+
* Copyright 2016-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -18,7 +18,7 @@
1818

1919
import org.bson.Document;
2020

21-
import org.springframework.data.mongodb.MongoDatabaseFactory;
21+
import org.springframework.data.mongodb.MongoDbFactory;
2222
import org.springframework.data.mongodb.core.CollectionCallback;
2323
import org.springframework.data.mongodb.core.MongoOperations;
2424
import org.springframework.data.mongodb.core.MongoTemplate;
@@ -47,7 +47,7 @@
4747
*/
4848
public class MongoDbOutboundGateway extends AbstractReplyProducingMessageHandler {
4949

50-
private MongoDatabaseFactory mongoDbFactory;
50+
private MongoDbFactory mongoDbFactory;
5151

5252
private MongoConverter mongoConverter;
5353

@@ -65,12 +65,12 @@ public class MongoDbOutboundGateway extends AbstractReplyProducingMessageHandler
6565

6666
private Expression collectionNameExpression;
6767

68-
public MongoDbOutboundGateway(MongoDatabaseFactory mongoDbFactory) {
68+
public MongoDbOutboundGateway(MongoDbFactory mongoDbFactory) {
6969
this(mongoDbFactory, new MappingMongoConverter(new DefaultDbRefResolver(mongoDbFactory),
7070
new MongoMappingContext()));
7171
}
7272

73-
public MongoDbOutboundGateway(MongoDatabaseFactory mongoDbFactory, MongoConverter mongoConverter) {
73+
public MongoDbOutboundGateway(MongoDbFactory mongoDbFactory, MongoConverter mongoConverter) {
7474
Assert.notNull(mongoDbFactory, "mongoDatabaseFactory must not be null.");
7575
Assert.notNull(mongoConverter, "mongoConverter must not be null.");
7676
this.mongoDbFactory = mongoDbFactory;

spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/outbound/MongoDbStoringMessageHandler.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2007-2019 the original author or authors.
2+
* Copyright 2007-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -16,7 +16,7 @@
1616

1717
package org.springframework.integration.mongodb.outbound;
1818

19-
import org.springframework.data.mongodb.MongoDatabaseFactory;
19+
import org.springframework.data.mongodb.MongoDbFactory;
2020
import org.springframework.data.mongodb.core.MongoOperations;
2121
import org.springframework.data.mongodb.core.MongoTemplate;
2222
import org.springframework.data.mongodb.core.convert.MongoConverter;
@@ -42,7 +42,7 @@ public class MongoDbStoringMessageHandler extends AbstractMessageHandler {
4242

4343
private volatile MongoOperations mongoTemplate;
4444

45-
private volatile MongoDatabaseFactory mongoDbFactory;
45+
private volatile MongoDbFactory mongoDbFactory;
4646

4747
private volatile MongoConverter mongoConverter;
4848

@@ -53,11 +53,11 @@ public class MongoDbStoringMessageHandler extends AbstractMessageHandler {
5353
private volatile boolean initialized = false;
5454

5555
/**
56-
* Will construct this instance using provided {@link MongoDatabaseFactory}
56+
* Will construct this instance using provided {@link MongoDbFactory}
5757
*
5858
* @param mongoDbFactory The mongodb factory.
5959
*/
60-
public MongoDbStoringMessageHandler(MongoDatabaseFactory mongoDbFactory) {
60+
public MongoDbStoringMessageHandler(MongoDbFactory mongoDbFactory) {
6161
Assert.notNull(mongoDbFactory, "'mongoDbFactory' must not be null");
6262

6363
this.mongoDbFactory = mongoDbFactory;
@@ -78,7 +78,7 @@ public MongoDbStoringMessageHandler(MongoOperations mongoTemplate) {
7878
/**
7979
* Allows you to provide custom {@link MongoConverter} used to assist in serialization
8080
* of data written to MongoDb. Only allowed if this instance was constructed with a
81-
* {@link MongoDatabaseFactory}.
81+
* {@link MongoDbFactory}.
8282
*
8383
* @param mongoConverter The mongo converter.
8484
*/

spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/store/AbstractConfigurableMongoDbMessageStore.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014-2019 the original author or authors.
2+
* Copyright 2014-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -32,7 +32,7 @@
3232
import org.springframework.context.ApplicationContextAware;
3333
import org.springframework.dao.DuplicateKeyException;
3434
import org.springframework.data.domain.Sort;
35-
import org.springframework.data.mongodb.MongoDatabaseFactory;
35+
import org.springframework.data.mongodb.MongoDbFactory;
3636
import org.springframework.data.mongodb.core.FindAndModifyOptions;
3737
import org.springframework.data.mongodb.core.MongoTemplate;
3838
import org.springframework.data.mongodb.core.convert.DefaultDbRefResolver;
@@ -76,7 +76,7 @@ public abstract class AbstractConfigurableMongoDbMessageStore extends AbstractMe
7676

7777
protected final String collectionName; // NOSONAR - final
7878

79-
protected final MongoDatabaseFactory mongoDbFactory; // NOSONAR - final
79+
protected final MongoDbFactory mongoDbFactory; // NOSONAR - final
8080

8181
private MongoTemplate mongoTemplate;
8282

@@ -94,11 +94,11 @@ public AbstractConfigurableMongoDbMessageStore(MongoTemplate mongoTemplate, Stri
9494
this.mongoDbFactory = null;
9595
}
9696

97-
public AbstractConfigurableMongoDbMessageStore(MongoDatabaseFactory mongoDbFactory, String collectionName) {
97+
public AbstractConfigurableMongoDbMessageStore(MongoDbFactory mongoDbFactory, String collectionName) {
9898
this(mongoDbFactory, null, collectionName);
9999
}
100100

101-
public AbstractConfigurableMongoDbMessageStore(MongoDatabaseFactory mongoDbFactory,
101+
public AbstractConfigurableMongoDbMessageStore(MongoDbFactory mongoDbFactory,
102102
MappingMongoConverter mappingMongoConverter, String collectionName) {
103103
Assert.notNull(mongoDbFactory, "'mongoDbFactory' must not be null");
104104
Assert.hasText(collectionName, "'collectionName' must not be empty");

spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/store/ConfigurableMongoDbMessageStore.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2013-2019 the original author or authors.
2+
* Copyright 2013-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -25,7 +25,7 @@
2525
import java.util.stream.StreamSupport;
2626

2727
import org.springframework.data.domain.Sort;
28-
import org.springframework.data.mongodb.MongoDatabaseFactory;
28+
import org.springframework.data.mongodb.MongoDbFactory;
2929
import org.springframework.data.mongodb.core.MongoTemplate;
3030
import org.springframework.data.mongodb.core.convert.MappingMongoConverter;
3131
import org.springframework.data.mongodb.core.query.Criteria;
@@ -68,19 +68,19 @@ public ConfigurableMongoDbMessageStore(MongoTemplate mongoTemplate, String colle
6868
super(mongoTemplate, collectionName);
6969
}
7070

71-
public ConfigurableMongoDbMessageStore(MongoDatabaseFactory mongoDbFactory) {
71+
public ConfigurableMongoDbMessageStore(MongoDbFactory mongoDbFactory) {
7272
this(mongoDbFactory, null, DEFAULT_COLLECTION_NAME);
7373
}
7474

75-
public ConfigurableMongoDbMessageStore(MongoDatabaseFactory mongoDbFactory, MappingMongoConverter mappingMongoConverter) {
75+
public ConfigurableMongoDbMessageStore(MongoDbFactory mongoDbFactory, MappingMongoConverter mappingMongoConverter) {
7676
this(mongoDbFactory, mappingMongoConverter, DEFAULT_COLLECTION_NAME);
7777
}
7878

79-
public ConfigurableMongoDbMessageStore(MongoDatabaseFactory mongoDbFactory, String collectionName) {
79+
public ConfigurableMongoDbMessageStore(MongoDbFactory mongoDbFactory, String collectionName) {
8080
this(mongoDbFactory, null, collectionName);
8181
}
8282

83-
public ConfigurableMongoDbMessageStore(MongoDatabaseFactory mongoDbFactory, MappingMongoConverter mappingMongoConverter,
83+
public ConfigurableMongoDbMessageStore(MongoDbFactory mongoDbFactory, MappingMongoConverter mappingMongoConverter,
8484
String collectionName) {
8585

8686
super(mongoDbFactory, mappingMongoConverter, collectionName);

spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/store/MongoDbChannelMessageStore.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014-2019 the original author or authors.
2+
* Copyright 2014-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -17,7 +17,7 @@
1717
package org.springframework.integration.mongodb.store;
1818

1919
import org.springframework.data.domain.Sort;
20-
import org.springframework.data.mongodb.MongoDatabaseFactory;
20+
import org.springframework.data.mongodb.MongoDbFactory;
2121
import org.springframework.data.mongodb.core.MongoTemplate;
2222
import org.springframework.data.mongodb.core.convert.MappingMongoConverter;
2323
import org.springframework.data.mongodb.core.index.Index;
@@ -61,19 +61,19 @@ public MongoDbChannelMessageStore(MongoTemplate mongoTemplate, String collection
6161
super(mongoTemplate, collectionName);
6262
}
6363

64-
public MongoDbChannelMessageStore(MongoDatabaseFactory mongoDbFactory) {
64+
public MongoDbChannelMessageStore(MongoDbFactory mongoDbFactory) {
6565
this(mongoDbFactory, null, DEFAULT_COLLECTION_NAME);
6666
}
6767

68-
public MongoDbChannelMessageStore(MongoDatabaseFactory mongoDbFactory, MappingMongoConverter mappingMongoConverter) {
68+
public MongoDbChannelMessageStore(MongoDbFactory mongoDbFactory, MappingMongoConverter mappingMongoConverter) {
6969
this(mongoDbFactory, mappingMongoConverter, DEFAULT_COLLECTION_NAME);
7070
}
7171

72-
public MongoDbChannelMessageStore(MongoDatabaseFactory mongoDbFactory, String collectionName) {
72+
public MongoDbChannelMessageStore(MongoDbFactory mongoDbFactory, String collectionName) {
7373
this(mongoDbFactory, null, collectionName);
7474
}
7575

76-
public MongoDbChannelMessageStore(MongoDatabaseFactory mongoDbFactory, MappingMongoConverter mappingMongoConverter,
76+
public MongoDbChannelMessageStore(MongoDbFactory mongoDbFactory, MappingMongoConverter mappingMongoConverter,
7777
String collectionName) {
7878
super(mongoDbFactory, mappingMongoConverter, collectionName);
7979
}

0 commit comments

Comments
 (0)