I am using spring boot 2.0.3.RELEASE. I tried to write an interceptor when the query is executed.When I finished writing, I found that although the code of the interceptor was implemented, I still couldn’t get the return value.
```java
@Intercepts({
@Signature(
type = Executor.class,method = "query",
args = {MappedStatement.class,Object.class,RowBounds.class,ResultHandler.class}
)
})
@Component
public class PageInterceptor implements Interceptor {
@Override
public Object intercept(Invocation invocation) throws Throwable {
final Object[] args = invocation.getArgs();
ResultHandler handler = e ->{
System.out.println(e.getResultObject());
};
args[3] = handler;
Object proceed = invocation.proceed();
return proceed;
}
...
}
```
The data is printed, but the result is empty.
When I debug the code i have some questions.This is the code of mybatis
```java
package org.apache.ibatis.executor.resultset;
DefaultResultSetHandler
private void handleResultSet(ResultSetWrapper rsw, ResultMap resultMap, List<Object> multipleResults, ResultMapping parentMapping) throws SQLException {
try {
if (parentMapping != null) {
handleRowValues(rsw, resultMap, null, RowBounds.DEFAULT, parentMapping);
} else {
//When no ResultHandler is specified multipleResults.add(defaultResultHandler.getResultList());
if (resultHandler == null) {
DefaultResultHandler defaultResultHandler = new DefaultResultHandler(objectFactory);
handleRowValues(rsw, resultMap, defaultResultHandler, rowBounds, null);
multipleResults.add(defaultResultHandler.getResultList());
} else {
//this multipleResults is empty
handleRowValues(rsw, resultMap, resultHandler, rowBounds, null);
}
}
} finally {
// issue #228 (close resultsets)
closeResultSet(rsw.getResultSet());
}
}
```
I don't know if it is caused by this reason.When I specified the DefaultResultSetHandler.How to get the results?