-
Notifications
You must be signed in to change notification settings - Fork 327
Description
When we updated to 10.4.0 we were unable to get dataloaders for apps that use AOT or GraalVM.
We tracked down the issue to the new dataloader reload feature changing a class to an interface.
Before 10.4.0:
AOT generated
public static BeanDefinition getDgsDataLoaderProviderBeanDefinition() {
RootBeanDefinition beanDefinition = new RootBeanDefinition(DgsDataLoaderProvider.class);
beanDefinition.setInitMethodNames("findDataLoaders$graphql_dgs");
beanDefinition.setFactoryBeanName("com.netflix.graphql.dgs.springgraphql.autoconfig.DgsSpringGraphQLAutoConfiguration");
beanDefinition.setInstanceSupplier(getDgsDataLoaderProviderInstanceSupplier());
return beanDefinition;
}
After 10.4.0:
AOT generated
public static BeanDefinition getDgsDataLoaderProviderBeanDefinition() {
RootBeanDefinition beanDefinition = new RootBeanDefinition(DgsDataLoaderProvider.class);
beanDefinition.setFactoryBeanName("com.netflix.graphql.dgs.springgraphql.autoconfig.DgsSpringGraphQLAutoConfiguration");
beanDefinition.setInstanceSupplier(getDgsDataLoaderProviderInstanceSupplier());
return beanDefinition;
}
The missing init method causes the dataloader registry not to get populated.
Proposed fix:
Change DgsDataLoaderProvider to DefaultDgsDataLoaderProvider when creating the bean here. This allows AOT to detect the @PostConstruct annotation properly in DefaultDgsDataLoaderProvider. This is analogous to the changes made in this PR.