Skip to content

Get access to DataFetchingEnvironment from KotlinDataLoader #1145

Answered by smyrick
JajaComp asked this question in Q&A
Discussion options

You must be logged in to vote

KotlinDataLoader is an abstraction on graphql-java DataLoader that the spring server library will autowire for you.

You can always manually create and load data loaders where you can give it info in the DataFetchingEnvironment. Infact during execution, you have to use the DataFetchingEnvironment to get data loaders in the first place.

See the example app:

/**
* Register a custom [DataFetcher] to get a [Company] any time it appears in the schema
*/
@Component("CompanyDataFetcher")
class CompanyDataF…

Replies: 1 comment 9 replies

Comment options

You must be logged in to vote
9 replies
@JajaComp
Comment options

@smyrick
Comment options

@smyrick
Comment options

@JajaComp
Comment options

@smyrick
Comment options

Answer selected by smyrick
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1143 on May 13, 2021 06:51.