open fun dgsDataLoaderProvider()

in graphql-dgs-spring-graphql/src/main/kotlin/com/netflix/graphql/dgs/springgraphql/autoconfig/DgsSpringGraphQLAutoConfiguration.kt [217:281]


    open fun dgsDataLoaderProvider(
        applicationContext: ApplicationContext,
        dataloaderOptionProvider: DgsDataLoaderOptionsProvider,
        @Qualifier("dgsScheduledExecutorService") dgsScheduledExecutorService: ScheduledExecutorService,
        extensionProviders: List<DataLoaderInstrumentationExtensionProvider>,
        customizers: List<DgsDataLoaderCustomizer>,
    ): DgsDataLoaderProvider =
        DgsDataLoaderProvider(
            applicationContext = applicationContext,
            extensionProviders = extensionProviders,
            dataLoaderOptionsProvider = dataloaderOptionProvider,
            scheduledExecutorService = dgsScheduledExecutorService,
            scheduleDuration = dataloaderConfigProps.scheduleDuration,
            enableTickerMode = dataloaderConfigProps.tickerModeEnabled,
            customizers = customizers,
        )

    @Bean
    open fun entityFetcherRegistry(): EntityFetcherRegistry = EntityFetcherRegistry()

    @Bean
    @ConditionalOnMissingBean
    open fun dataFetcherExceptionHandler(): DataFetcherExceptionHandler = DefaultDataFetcherExceptionHandler()

    @Bean
    @ConditionalOnProperty(
        prefix = "${AUTO_CONF_PREFIX}.preparsedDocumentProvider",
        name = ["enabled"],
        havingValue = "true",
        matchIfMissing = false,
    )
    @ConditionalOnMissingBean
    open fun preparsedDocumentProvider(configProps: DgsConfigurationProperties): PreparsedDocumentProvider =
        DgsDefaultPreparsedDocumentProvider(
            configProps.preparsedDocumentProvider.maximumCacheSize,
            Duration.parse(configProps.preparsedDocumentProvider.cacheValidityDuration),
        )

    @Bean
    @ConditionalOnMissingBean
    open fun graphQLContextBuilder(
        dgsCustomContextBuilder: Optional<DgsCustomContextBuilder<*>>,
        dgsCustomContextBuilderWithRequest: Optional<DgsCustomContextBuilderWithRequest<*>>,
    ): DefaultDgsGraphQLContextBuilder = DefaultDgsGraphQLContextBuilder(dgsCustomContextBuilder, dgsCustomContextBuilderWithRequest)

    /**
     * Used by the [ReloadableGraphQLSource], it controls if, and when, such executor should reload the schema.
     * This implementation will return either the boolean value of the `dgs.reload` flag
     * or `true` if the `laptop` profile is an active Spring Boot profiles.
     * <p>
     * You can provide a bean of type [ReloadSchemaIndicator] if you want to control when the
     * [ReloadableGraphQLSource] should reload the schema.
     *
     * @implSpec the implementation of such bean should be thread-safe.
     */
    @Bean
    @ConditionalOnMissingBean
    open fun defaultReloadSchemaIndicator(environment: Environment): ReloadSchemaIndicator {
        val isLaptopProfile = environment.activeProfiles.contains("laptop")
        val hotReloadSetting = environment.getProperty("dgs.reload", Boolean::class.java, isLaptopProfile)

        return ReloadSchemaIndicator {
            hotReloadSetting
        }
    }