![](/img/trans.png)
[英]spring boot containing com.graphql-java and graphql-java-spring-boot-starter-webmvc
[英]Enable or disable async mode in Spring for GraphQL (WebMvc)
使用org.springframework.boot:spring-boot-starter-graphql
和 WebMvc,我在運行查詢時出現以下錯誤: Caused by: java.lang.IllegalStateException: Async support must be enabled on a servlet and for all filters involved in async request processing. This is done in Java code using the Servlet API or by adding "<async-supported>true</async-supported>" to servlet and filter declarations in web.xml.
Caused by: java.lang.IllegalStateException: Async support must be enabled on a servlet and for all filters involved in async request processing. This is done in Java code using the Servlet API or by adding "<async-supported>true</async-supported>" to servlet and filter declarations in web.xml.
async-supported
?異步調度無法通過簡單的屬性禁用,因此不建議這樣做,因為 GraphQL Java 默認使用AsyncExecutionStrategy
。 我想說這在 GraphQL 方法中非常重要,其中部分模式可以從多個來源(數據存儲、web API 等)解析,並且引擎會對其進行優化。
如果您收到此錯誤,這意味着您配置了一個自定義過濾器,該過濾器未配置為異步支持(並且仍然映射為 ASYNC 調度)。 一般來說,你應該檢查你的整個過濾器/Servlet/容器安排來檢查。 理想情況下,您可以從新的https://start.spring.io開始,並一一添加自定義過濾器和配置。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.