Java.util.concurrent.CompletionException: org.springframework.beans.factory.support.ScopeNotActiveExceptionJAVA

Программисты JAVA общаются здесь
Ответить
Anonymous
 Java.util.concurrent.CompletionException: org.springframework.beans.factory.support.ScopeNotActiveException

Сообщение Anonymous »

Попытка выполнить ниже кусок кода, но получение ошибки, как указано, следует. Есть предложения, чтобы исправить это? Исходный код < /p>
CompletableFuture[] futures = stringList.stream().map(stringListRef -> CompletableFuture.supplyAsync(() -> {
String[] stringArray = stringListRef.split("-");
return someClass.someMethod(stringArray[0], stringArray[1], string1, "", string2);
}).thenAccept(response -> responseMap.put(stringListRef, response))).toArray(CompletableFuture[]::new);
CompletableFuture.allOf(futures).join();

Ошибка
java.util.concurrent.CompletableFuture@ec79b7[Completed exceptionally: java.util.concurrent.CompletionException: org.springframework.beans.factory.support.ScopeNotActiveException: Error creating bean with name 'scopedTarget.clientContextProcessor': 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 singleton; nested exception is java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.]


Подробнее здесь: https://stackoverflow.com/questions/793 ... ctory-supp
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «JAVA»