Попытка выполнить ниже кусок кода, но получение ошибки, как указано, следует. Есть предложения, чтобы исправить это? Исходный код < /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
Java.util.concurrent.CompletionException: org.springframework.beans.factory.support.ScopeNotActiveException ⇐ JAVA
Программисты JAVA общаются здесь
1737704391
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.]
Подробнее здесь: [url]https://stackoverflow.com/questions/79383546/java-util-concurrent-completionexception-org-springframework-beans-factory-supp[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия