【发布时间】:2021-06-27 08:42:04
【问题描述】:
您好,我正在搭建一个桥梁,将 GraphQL 的其他查询转换为另一个服务。我的想法是从查询中获取 json 到 GraphQL 并通过 resttemplate 进行查询。但我找不到获取请求正文的方法。 我很高兴看到您的代码示例或其他更有效的解决方案。
堆栈:Spring boot+ java 8 + graphql
@Component
public class VehicleQuery implements GraphQLQueryResolver {
@Autowired
private VehicleService vehicleService;
public List<Vehicle> getVehicles(final int count) {
return this.vehicleService.getAllVehicles(count);
}
public Optional<Vehicle> getVehicle(final int id) {
return this.vehicleService.getVehicle(id);
}
}
【问题讨论】:
标签: java spring spring-boot graphql