【发布时间】:2021-03-09 14:18:37
【问题描述】:
我需要为我的响应式 Spring 应用实现一个 graphql 查询解析器。
这是我的 graphlq 架构:
type Post{
id: String!
title: String
}
type Query {
posts: [Post!]!
}
我的解析器看起来像这样:
public Flux<Post> posts(){ ...}
我正在使用 graphiql-spring-boot-starter 5.0.2 和 graphql-java-tools 5.2.4
【问题讨论】:
-
只是一个更新,我最终关注了这个example。我将方法从
public Flux<Post> posts(){ ...}更改为public Publisher<Post> posts(){ ...}。来自 org.reactivestreams 的 Publisher 接口。在方法内部,我返回了一个 Flux。另外,必须将我的查询更改为订阅。
标签: spring-boot spring-webflux graphql-java