使用@Async时,作用域 'request' 对当前线程不处于活动状态



低于错误。 使用@Async时,范围"请求"对于当前线程不处于活动状态

Error creating bean with name 'scopedTarget.domainMetadata': Scope 'request' is not active for the current thread; consider defining a scoped proxy for this bean if you intend to refer to it from a s...","level":"ERROR","logger":"org.springframework.aop.interceptor.SimpleAsyncUncaughtExceptionHandler","thread":"SimpleAsyncTaskExecutor-3","throwable_class":"FatalBeanException","throwable_root_cause_class":"java.lang.IllegalStateException"}
@Async 
public String sample(Event obj){ 
eventProcess.processObject(obj); 
} 

在执行进程对象对象时,我得到上述异常。但流不会终止。processObject 方法存在于不在同一应用程序中的另一个依赖项中

这是正确的,@Async线程不能绑定或使用请求范围,因为异步执行中没有请求范围。

最新更新