micronaut-projects / micronaut-graphql

A repository for Micronaut and GraphQL integrations
Apache License 2.0
81 stars 43 forks source link

GraphQL Dependency conflict #175

Closed fabienmifsud closed 3 years ago

fabienmifsud commented 3 years ago

Thanks for reporting an issue, please review the task list below before submitting the issue. Your issue report will be closed if the issue is incomplete and the below tasks not completed.

NOTE: If you are unsure about something and the issue is more of a question a better place to ask questions is on Stack Overflow (https://stackoverflow.com/tags/micronaut) or Gitter (https://gitter.im/micronautfw/). DO NOT use the issue tracker to ask questions.

Task List

Steps to Reproduce

  1. Use micronaut-graphql version 2.2.0
  2. Add the dependency :
       <dependency>
            <groupId>io.leangen.graphql</groupId>
            <artifactId>spqr</artifactId>
            <version>0.11.1</version>
        </dependency>
  3. Write a factory :

    @Factory
    public class GraphQLFactory {
    
    @Inject
    protected BeanContext beanContext;
    
    @Bean
    @Singleton
    public GraphQL graphQL() {
        GraphQLSchemaGenerator schemaGenerator = new GraphQLSchemaGenerator(); // 1
    
        Collection graphQLServices = beanContext.getBeansOfType(Object.class, Qualifiers.byStereotype(GraphQLService.class));
    
        if (graphQLServices.isEmpty()) {
            return new GraphQL.Builder(GraphQLSchema.newSchema().build())
                    .build();
        } else { // 4
            for (Object graphQLService : graphQLServices) {
                Class graphQLServiceClass = graphQLService.getClass();
                if (graphQLServiceClass.getSimpleName().contains("$Intercepted"))
                    graphQLServiceClass = graphQLServiceClass.getSuperclass();
    
                schemaGenerator.withOperationsFromSingleton(graphQLService, graphQLServiceClass);
            }
        }
    
        return new GraphQL.Builder(schemaGenerator.generate()).build();
    }
    }

Expected Behaviour

The process should start and accept graphql queries.

Actual Behaviour

Failing with Message: java.lang.NoSuchMethodError: graphql.schema.GraphQLType.getName()Ljava/lang/String; Path Taken: new GraphQLController([GraphQLInvocation graphQLInvocation],GraphQLExecutionResultHandler graphQLExecutionResultHandler,GraphQLJsonSerializer graphQLJsonSerializer) --> new DefaultGraphQLInvocation([GraphQL graphQL],GraphQLExecutionInputCustomizer graphQLExecutionInputCustomizer,Provider dataLoaderRegistry)

Environment Information

Example Application

ilopmar commented 3 years ago

Fixed in #190