15
15
*/
16
16
package org .springframework .data .mongodb .repository .aot ;
17
17
18
- import static org .assertj .core .api .Assertions .assertThat ;
18
+ import static org .assertj .core .api .Assertions .* ;
19
19
20
20
import example .aot .User ;
21
21
import example .aot .UserRepository ;
26
26
import java .util .List ;
27
27
import java .util .regex .Pattern ;
28
28
29
- import javax .lang .model .element .Modifier ;
30
-
31
29
import org .junit .jupiter .api .Assertions ;
32
30
import org .junit .jupiter .api .Test ;
31
+
33
32
import org .springframework .data .domain .Limit ;
34
33
import org .springframework .data .domain .Pageable ;
35
34
import org .springframework .data .domain .Range ;
43
42
import org .springframework .data .geo .GeoResults ;
44
43
import org .springframework .data .geo .Point ;
45
44
import org .springframework .data .geo .Polygon ;
46
- import org .springframework .data .mongodb .core .MongoOperations ;
47
45
import org .springframework .data .mongodb .core .annotation .Collation ;
48
46
import org .springframework .data .mongodb .core .geo .GeoJsonPolygon ;
49
47
import org .springframework .data .mongodb .core .geo .Sphere ;
52
50
import org .springframework .data .mongodb .repository .VectorSearch ;
53
51
import org .springframework .data .repository .Repository ;
54
52
import org .springframework .data .repository .aot .generate .AotQueryMethodGenerationContext ;
55
- import org .springframework .data .repository .aot .generate .AotRepositoryFragmentMetadata ;
56
53
import org .springframework .data .repository .aot .generate .MethodContributor ;
57
54
import org .springframework .data .repository .core .RepositoryInformation ;
58
55
import org .springframework .data .repository .query .QueryMethod ;
59
- import org .springframework .javapoet .FieldSpec ;
60
56
import org .springframework .javapoet .MethodSpec ;
61
57
62
58
/**
@@ -403,12 +399,9 @@ private static MethodSpec codeOf(Class<?> repository, String methodName, Class<?
403
399
Assertions .fail ("No contribution for method %s.%s(%s)" .formatted (repository .getSimpleName (), methodName ,
404
400
Arrays .stream (args ).map (Class ::getSimpleName ).toList ()));
405
401
}
406
- AotRepositoryFragmentMetadata metadata = new AotRepositoryFragmentMetadata ();
407
- metadata .addField (
408
- FieldSpec .builder (MongoOperations .class , "mongoOperations" , Modifier .PRIVATE , Modifier .FINAL ).build ());
409
-
410
402
TestQueryMethodGenerationContext methodContext = new TestQueryMethodGenerationContext (
411
- repoContext .getRepositoryInformation (), method , methodContributor .getQueryMethod (), metadata );
403
+ repoContext .getRepositoryInformation (), method , methodContributor .getQueryMethod ());
404
+
412
405
return methodContributor .contribute (methodContext );
413
406
}
414
407
@@ -425,9 +418,9 @@ private static CharSequence string(String s) {
425
418
426
419
static class TestQueryMethodGenerationContext extends AotQueryMethodGenerationContext {
427
420
428
- protected TestQueryMethodGenerationContext (RepositoryInformation repositoryInformation , Method method ,
429
- QueryMethod queryMethod , AotRepositoryFragmentMetadata targetTypeMetadata ) {
430
- super (repositoryInformation , method , queryMethod , targetTypeMetadata );
421
+ TestQueryMethodGenerationContext (RepositoryInformation repositoryInformation , Method method ,
422
+ QueryMethod queryMethod ) {
423
+ super (repositoryInformation , method , queryMethod );
431
424
}
432
425
}
433
426
0 commit comments