15
15
*/
16
16
package org .springframework .data .mongodb .repository .support ;
17
17
18
+ import lombok .AccessLevel ;
19
+ import lombok .RequiredArgsConstructor ;
20
+
18
21
import java .io .Serializable ;
19
22
import java .lang .reflect .Method ;
20
23
import java .util .Arrays ;
21
24
22
25
import org .reactivestreams .Publisher ;
23
- import org .springframework .core .convert .ConversionService ;
24
- import org .springframework .core .convert .support .DefaultConversionService ;
25
26
import org .springframework .dao .InvalidDataAccessApiUsageException ;
26
27
import org .springframework .data .mapping .context .MappingContext ;
27
28
import org .springframework .data .mapping .model .MappingException ;
28
29
import org .springframework .data .mongodb .core .ReactiveMongoOperations ;
29
30
import org .springframework .data .mongodb .core .mapping .MongoPersistentEntity ;
30
31
import org .springframework .data .mongodb .core .mapping .MongoPersistentProperty ;
31
32
import org .springframework .data .mongodb .repository .query .MongoEntityInformation ;
32
- import org .springframework .data .mongodb .repository .query .MongoQueryMethod ;
33
33
import org .springframework .data .mongodb .repository .query .PartTreeMongoQuery ;
34
34
import org .springframework .data .mongodb .repository .query .ReactiveMongoQueryMethod ;
35
35
import org .springframework .data .mongodb .repository .query .ReactivePartTreeMongoQuery ;
43
43
import org .springframework .data .repository .query .QueryLookupStrategy ;
44
44
import org .springframework .data .repository .query .QueryLookupStrategy .Key ;
45
45
import org .springframework .data .repository .query .RepositoryQuery ;
46
- import org .springframework .data .repository .util .QueryExecutionConverters ;
47
46
import org .springframework .data .repository .util .ReactiveWrapperConverters ;
48
47
import org .springframework .data .repository .util .ReactiveWrappers ;
49
48
import org .springframework .expression .spel .standard .SpelExpressionParser ;
55
54
*
56
55
* @author Mark Paluch
57
56
* @author Christoph Strobl
57
+ * @author Oliver Gierke
58
58
* @since 2.0
59
59
*/
60
60
public class ReactiveMongoRepositoryFactory extends RepositoryFactorySupport {
@@ -63,7 +63,6 @@ public class ReactiveMongoRepositoryFactory extends RepositoryFactorySupport {
63
63
64
64
private final ReactiveMongoOperations operations ;
65
65
private final MappingContext <? extends MongoPersistentEntity <?>, MongoPersistentProperty > mappingContext ;
66
- private final ConversionService conversionService ;
67
66
68
67
/**
69
68
* Creates a new {@link ReactiveMongoRepositoryFactory} with the given {@link ReactiveMongoOperations}.
@@ -76,12 +75,6 @@ public ReactiveMongoRepositoryFactory(ReactiveMongoOperations mongoOperations) {
76
75
77
76
this .operations = mongoOperations ;
78
77
this .mappingContext = mongoOperations .getConverter ().getMappingContext ();
79
-
80
- DefaultConversionService conversionService = new DefaultConversionService ();
81
- ReactiveWrapperConverters .registerConvertersIn (conversionService );
82
-
83
- this .conversionService = conversionService ;
84
- setConversionService (conversionService );
85
78
}
86
79
87
80
/*
@@ -111,7 +104,7 @@ protected Object getTargetRepository(RepositoryInformation information) {
111
104
*/
112
105
@ Override
113
106
protected QueryLookupStrategy getQueryLookupStrategy (Key key , EvaluationContextProvider evaluationContextProvider ) {
114
- return new MongoQueryLookupStrategy (operations , evaluationContextProvider , mappingContext , conversionService );
107
+ return new MongoQueryLookupStrategy (operations , evaluationContextProvider , mappingContext );
115
108
}
116
109
117
110
/*
@@ -131,7 +124,7 @@ protected void validate(RepositoryMetadata repositoryMetadata) {
131
124
132
125
if (!ReactiveWrappers .isAvailable ()) {
133
126
throw new InvalidDataAccessApiUsageException (
134
- String .format ("Cannot implement Repository %s without reactive library support." ,
127
+ String .format ("Cannot implement repository %s without reactive library support." ,
135
128
repositoryMetadata .getRepositoryInterface ().getName ()));
136
129
}
137
130
@@ -189,22 +182,12 @@ private <T, ID extends Serializable> MongoEntityInformation<T, ID> getEntityInfo
189
182
*
190
183
* @author Mark Paluch
191
184
*/
185
+ @ RequiredArgsConstructor (access = AccessLevel .PACKAGE )
192
186
private static class MongoQueryLookupStrategy implements QueryLookupStrategy {
193
187
194
188
private final ReactiveMongoOperations operations ;
195
189
private final EvaluationContextProvider evaluationContextProvider ;
196
- MappingContext <? extends MongoPersistentEntity <?>, MongoPersistentProperty > mappingContext ;
197
- final ConversionService conversionService ;
198
-
199
- MongoQueryLookupStrategy (ReactiveMongoOperations operations , EvaluationContextProvider evaluationContextProvider ,
200
- MappingContext <? extends MongoPersistentEntity <?>, MongoPersistentProperty > mappingContext ,
201
- ConversionService conversionService ) {
202
-
203
- this .operations = operations ;
204
- this .evaluationContextProvider = evaluationContextProvider ;
205
- this .mappingContext = mappingContext ;
206
- this .conversionService = conversionService ;
207
- }
190
+ private final MappingContext <? extends MongoPersistentEntity <?>, MongoPersistentProperty > mappingContext ;
208
191
209
192
/*
210
193
* (non-Javadoc)
@@ -220,12 +203,11 @@ public RepositoryQuery resolveQuery(Method method, RepositoryMetadata metadata,
220
203
if (namedQueries .hasQuery (namedQueryName )) {
221
204
String namedQuery = namedQueries .getQuery (namedQueryName );
222
205
return new ReactiveStringBasedMongoQuery (namedQuery , queryMethod , operations , EXPRESSION_PARSER ,
223
- evaluationContextProvider , conversionService );
206
+ evaluationContextProvider );
224
207
} else if (queryMethod .hasAnnotatedQuery ()) {
225
- return new ReactiveStringBasedMongoQuery (queryMethod , operations , EXPRESSION_PARSER , evaluationContextProvider ,
226
- conversionService );
208
+ return new ReactiveStringBasedMongoQuery (queryMethod , operations , EXPRESSION_PARSER , evaluationContextProvider );
227
209
} else {
228
- return new ReactivePartTreeMongoQuery (queryMethod , operations , conversionService );
210
+ return new ReactivePartTreeMongoQuery (queryMethod , operations );
229
211
}
230
212
}
231
213
}
0 commit comments