1717
1818import java .lang .reflect .Method ;
1919import java .util .Collections ;
20+ import java .util .HashMap ;
2021import java .util .List ;
2122import java .util .Map ;
2223import java .util .Optional ;
@@ -78,9 +79,9 @@ public QueryExecutorMethodInterceptor(RepositoryInformation repositoryInformatio
7879
7980 if (!queryLookupStrategy .isPresent () && repositoryInformation .hasQueryMethods ()) {
8081
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" );
8485 }
8586
8687 this .queries = queryLookupStrategy //
@@ -91,10 +92,17 @@ public QueryExecutorMethodInterceptor(RepositoryInformation repositoryInformatio
9192 private Map <Method , RepositoryQuery > mapMethodsToQuery (RepositoryInformation repositoryInformation ,
9293 QueryLookupStrategy lookupStrategy , ProjectionFactory projectionFactory ) {
9394
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 ;
98106 }
99107
100108 private Pair <Method , RepositoryQuery > lookupQuery (Method method , RepositoryInformation information ,
0 commit comments