Support context parameters in @BatchMapping methods

Closes gh-172
This commit is contained in:
Rossen Stoyanchev
2021-12-08 13:44:19 +00:00
parent 50aeaba63e
commit b22cef00ab
3 changed files with 22 additions and 4 deletions

View File

@@ -927,10 +927,11 @@ the simple class name of the input `List` element type. Both can be customized t
annotation attributes. The type name can also be inherited from a class level
`@SchemaMapping`.
[[controllers-batch-mapping-signature]]
==== Method Signature
Batch mapping methods support two types of arguments:
Batch mapping methods support the following arguments:
[cols="1,2"]
|===
@@ -942,10 +943,19 @@ Batch mapping methods support two types of arguments:
| `java.security.Principal`
| Obtained from Spring Security context, if available.
| `@ContextValue`
| For access to a value from the `GraphQLContext` of `BatchLoaderEnvironment`,
which is the same context as the one from the `DataFetchingEnvironment`.
| `GraphQLContext`
| For access to the context from the `BatchLoaderEnvironment`,
which is the same context as the one from the `DataFetchingEnvironment`.
| `BatchLoaderEnvironment`
| The environment that is available in GraphQL Java to a
`org.dataloader.BatchLoaderWithContext`.
|===
Batch mapping methods can return: