Skip to content

Adding a DataLoader without the Annotation? #1685

Closed Answered by evanmalmud
evanmalmud asked this question in Q&A
Discussion options

You must be logged in to vote

Thanks to @srinivasankavitha you can now override options for dataloaders by making a DgsDataLoaderOptionsProvider bean

Create an implementation of DgsDataLoaderOptionsProvider

public class DataLoaderConfig implements DgsDataLoaderOptionsProvider {

  @NotNull
  @Override
  public DataLoaderOptions getOptions(@NotNull String s, @NotNull DgsDataLoader dgsDataLoader) {
    return DataLoaderOptions.newOptions()
        //Whatever options you want to set
        ;
  }

Create a bean of this class that will be automatically picked up by DGS

  @Bean
  public DgsDataLoaderOptionsProvider dgsDataLoaderOptionsProvider() {
    return new DataLoaderConfig();
  }

Replies: 3 comments 14 replies

Comment options

You must be logged in to vote
13 replies
@evanmalmud
Comment options

@evanmalmud
Comment options

@srinivasankavitha
Comment options

@evanmalmud
Comment options

@evanmalmud
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by evanmalmud
Comment options

You must be logged in to vote
1 reply
@deep18-appdirect
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants