在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):graphql-java-kickstart/graphql-spring-webclient开源软件地址(OpenSource Url):https://github.com/graphql-java-kickstart/graphql-spring-webclient开源编程语言(OpenSource Language):Java 95.7%开源软件介绍(OpenSource Introduction):GraphQL Spring WebclientReactive GraphQL client for consuming GraphQL APIs from a Spring Boot application. Provides OAuth2 authorization through configuration. Getting startedAdd the starter to your project. When using Maven: <dependency>
<groupId>com.graphql-java-kickstart</groupId>
<artifactId>graphql-webclient-spring-boot-starter</artifactId>
<version>1.0.0</version>
</dependency> When using gradle: implementation "com.graphql-java-kickstart:graphql-webclient-spring-boot-starter:1.0.0" Configure at least the URL of the GraphQL API to consume: graphql:
client:
url: https://graphql.github.com/graphql The starter creates a Spring bean of type @Component
class MyClass {
private final GraphQLWebClient graphQLWebClient;
MyClass(GraphQLWebClient graphQLWebClient) {
this.graphQLWebClient = graphQLWebClient;
}
String helloWorld() {
GraphQLRequest request = GraphQLRequest.builder().query("query { hello }").build();
GraphQLResponse response = graphQLWebClient.post(request).block();
return response.get("hello", String.class);
}
} Using latest SnapshotsYou can use the latest Snapshots by configuring the Snapshot repository, see https://www.graphql-java-kickstart.com/servlet/#using-the-latest-development-build. ConfigurationThe following tables list the configurable properties of the GraphQL Spring Webclient and their default values.
These properties are configured with the prefix
Max in memory sizeIn case you need to work with large responses you might run into the following error:
In that case starting with version 0.1.2 you can use the default Spring Boot configuration property to configure the max in memory size to use: spring.codec.max-in-memory-size=10MB |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论