17
17
18
18
import java .lang .reflect .Method ;
19
19
import java .util .Collections ;
20
+ import java .util .HashMap ;
20
21
import java .util .List ;
21
22
import java .util .Map ;
22
23
import java .util .Optional ;
@@ -78,9 +79,9 @@ public QueryExecutorMethodInterceptor(RepositoryInformation repositoryInformatio
78
79
79
80
if (!queryLookupStrategy .isPresent () && repositoryInformation .hasQueryMethods ()) {
80
81
81
- throw new IllegalStateException ("You have defined query methods in the repository"
82
- + " but do not have any query lookup strategy defined."
83
- + " The infrastructure apparently does not support query methods" );
82
+ throw new IllegalStateException (
83
+ "You have defined query methods in the repository" + " but do not have any query lookup strategy defined."
84
+ + " The infrastructure apparently does not support query methods" );
84
85
}
85
86
86
87
this .queries = queryLookupStrategy //
@@ -91,10 +92,17 @@ public QueryExecutorMethodInterceptor(RepositoryInformation repositoryInformatio
91
92
private Map <Method , RepositoryQuery > mapMethodsToQuery (RepositoryInformation repositoryInformation ,
92
93
QueryLookupStrategy lookupStrategy , ProjectionFactory projectionFactory ) {
93
94
94
- return repositoryInformation .getQueryMethods ().stream () //
95
- .map (method -> lookupQuery (method , repositoryInformation , lookupStrategy , projectionFactory )) //
96
- .peek (pair -> invokeListeners (pair .getSecond ())) //
97
- .collect (Pair .toMap ());
95
+ Map <Method , RepositoryQuery > result = new HashMap <>();
96
+
97
+ for (Method method : repositoryInformation .getQueryMethods ()) {
98
+
99
+ Pair <Method , RepositoryQuery > pair = lookupQuery (method , repositoryInformation , lookupStrategy ,
100
+ projectionFactory );
101
+ invokeListeners (pair .getSecond ());
102
+ result .put (pair .getFirst (), pair .getSecond ());
103
+ }
104
+
105
+ return result ;
98
106
}
99
107
100
108
private Pair <Method , RepositoryQuery > lookupQuery (Method method , RepositoryInformation information ,
0 commit comments