@Bean
@Scope(scopeName = WebApplicationContext.SCOPE_REQUEST,
proxyMode = ScopedProxyMode.TARGET_CLASS)
public AccessToken getAccessToken() {
HttpServletRequest request =
((ServletRequestAttributes) RequestContextHolder
.currentRequestAttributes()).getRequest();
return ((KeycloakPrincipal) request.getUserPrincipal())
.getKeycloakSecurityContext().getToken();
}
如何使它在子线程中可继承。 我想在异步方法调用中访问它。
有人可以帮我吗?