Skip to content
Discussion options

You must be logged in to vote

@arichardson175 , you are right. The @DefaultExecutor annotation is an internal construct and we should remove it from the docs. You will have to build an executor that is able to set, and re-set, the RequestAttributes available in the context of each thread. This is not a unique problem of the RequestAttributes but any context dependent construct, such as the SecurityContext as well.

Spring Security

In Spring Security you will have to leverage the DelegatingSecurityContextAsyncTaskExecutor.

@Bean 
public DelegatingSecurityContextAsyncTaskExecutor taskExecutor(ThreadPoolTaskExecutor delegate) { 
    return new DelegatingSecurityContextAsyncTaskExecutor(delegate); 
}

Spring Web MVC

class …

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@arichardson175
Comment options

@berngp
Comment options

berngp Aug 18, 2021
Collaborator

@arichardson175
Comment options

Answer selected by arichardson175
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants