Skip to content

Document how HandlerInterceptor should differentiate an ASYNC dispatch [SPR-12608] #17209

Closed
@spring-projects-issues

Description

@spring-projects-issues

Francisco Lozano opened SPR-12608 and commented

HandlerIntercetor#preHandle is invoked twice in an async scenario.

The problem is that it's not documented how to differentiate and avoid double-executing some logic. As it's a very common problem when using interceptors and using async handling, adding some explicit doc about how to handle would help.

if (DispatcherType.ASYNC.equals(request.getDispatcherType())) {
          return true;                
}
doStuffAsUsual();
return whatever;

Affects: 4.1.4

Reference URL: https://github.com/flozano/spring-interceptor-async-test

Issue Links:

Referenced from: commits 1803978

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions