leangen / graphql-spqr-spring-boot-starter

Spring Boot 2 starter powered by GraphQL SPQR
Apache License 2.0
276 stars 68 forks source link

@GraphQLApi annotated Spring Data Repository results in error creating GraphQLSchemaGenerator bean on startup #149

Open jamesdh opened 5 months ago

jamesdh commented 5 months ago

When trying to annotate a Spring Data Repository interface w/ @GraphQLApi, e.g...

@RepositoryRestResource
@GraphQLApi
public interface ZipCodeInfoRepository extends JpaRepository<ZipCodeInfo, String>, QuerydslPredicateExecutor<ZipCodeInfo>, QuerydslBinderCustomizer<QZipCodeInfo> {

    @GraphQLQuery(name = "zipcodeInfo")
    default Optional<ZipCodeInfo> zipcodeInfo(@GraphQLArgument(name="zip") @NonNull String zip) {
        return findById(zip);
    }
}

...we get the following:

Factory method 'graphQLSchemaGenerator' threw exception with message: The registered object is of generic type org.springframework.data.jpa.repository.support.SimpleJpaRepository. Provide the full type explicitly when registering the bean. For details and solutions see https://github.com/leangen/graphql-spqr/wiki/Errors#generic-top-level-singletons

I don't see a way w/ the spring-boot-starter to add operations to the GraphQLSchemaGenerator. This seems like a pretty straightforward use case, so I feel like I must be missing something?