Closed
Description
I was trying to upgrade the Spring Boot Starter from 5.1
to 5.2
but got a schema parser error.
It's a kotlin project containing:
type Query {
season(year: Int!): Season
seasons(first: Int = 10, offset: Int = 0): SeasonPage!
}
The GraphQLQueryResolver contains:
fun season(year: Int): Season? {
return seasonRepository.findByYear(year)
}
fun seasons(first: Int, offset: Int, environment: DataFetchingEnvironment): Page<Season> {
val sort = Sort.by("year").descending()
val seasons = if (isItemsSelected(environment)) seasonRepository.findAll(first, offset, sort) else null
val totalCount = if (isPageInfoSelected(environment)) seasonRepository.count() else null
return createPage(seasons, totalCount, first, offset)
}
where Page is a simple Kotlin data class:
data class Page<T>(
val items: List<T>?,
val hasNextPage: Boolean?,
val hasPreviousPage: Boolean?,
val totalCount: Long?
)
now when I run the app I get suddenly:
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.coxautodev.graphql.tools.SchemaParser]: Factory method 'schemaParser' threw exception; nested exception is com.coxautodev.graphql.tools.SchemaClassScannerError: Unable to match type definition (NonNullType{type=ListType{type=NonNullType{type=TypeName{name='Season'}}}}) with java type (interface java.util.List): Java class is not a List or generic type information was lost: interface java.util.List
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:620) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
... 123 common frames omitted
Caused by: com.coxautodev.graphql.tools.SchemaClassScannerError: Unable to match type definition (NonNullType{type=ListType{type=NonNullType{type=TypeName{name='Season'}}}}) with java type (interface java.util.List): Java class is not a List or generic type information was lost: interface java.util.List
at com.coxautodev.graphql.tools.TypeClassMatcher.error(TypeClassMatcher.kt:22) ~[graphql-java-tools-5.4.0.jar:na]
at com.coxautodev.graphql.tools.TypeClassMatcher.match(TypeClassMatcher.kt:82) ~[graphql-java-tools-5.4.0.jar:na]
at com.coxautodev.graphql.tools.TypeClassMatcher.match$default(TypeClassMatcher.kt:32) ~[graphql-java-tools-5.4.0.jar:na]
at com.coxautodev.graphql.tools.TypeClassMatcher.match(TypeClassMatcher.kt:75) ~[graphql-java-tools-5.4.0.jar:na]
at com.coxautodev.graphql.tools.TypeClassMatcher.match(TypeClassMatcher.kt:28) ~[graphql-java-tools-5.4.0.jar:na]
at com.coxautodev.graphql.tools.SchemaClassScanner.scanResolverInfoForPotentialMatches(SchemaClassScanner.kt:261) ~[graphql-java-tools-5.4.0.jar:na]
at com.coxautodev.graphql.tools.SchemaClassScanner.scanQueueItemForPotentialMatches(SchemaClassScanner.kt:244) ~[graphql-java-tools-5.4.0.jar:na]
at com.coxautodev.graphql.tools.SchemaClassScanner.scanQueue(SchemaClassScanner.kt:105) ~[graphql-java-tools-5.4.0.jar:na]
at com.coxautodev.graphql.tools.SchemaClassScanner.scanForClasses(SchemaClassScanner.kt:83) ~[graphql-java-tools-5.4.0.jar:na]
at com.coxautodev.graphql.tools.SchemaParserBuilder.scan(SchemaParserBuilder.kt:163) ~[graphql-java-tools-5.4.0.jar:na]
at com.coxautodev.graphql.tools.SchemaParserBuilder.build(SchemaParserBuilder.kt:204) ~[graphql-java-tools-5.4.0.jar:na]
at com.oembedler.moon.graphql.boot.GraphQLJavaToolsAutoConfiguration.schemaParser(GraphQLJavaToolsAutoConfiguration.java:101) ~[graphql-spring-boot-autoconfigure-5.2.jar:na]
at com.oembedler.moon.graphql.boot.GraphQLJavaToolsAutoConfiguration$$EnhancerBySpringCGLIB$$a4aea0aa.CGLIB$schemaParser$1(<generated>) ~[graphql-spring-boot-autoconfigure-5.2.jar:na]
at com.oembedler.moon.graphql.boot.GraphQLJavaToolsAutoConfiguration$$EnhancerBySpringCGLIB$$a4aea0aa$$FastClassBySpringCGLIB
it is working in 5.1
.
Maybe there is a regression in Java Tools 5.4.0
?
Metadata
Metadata
Assignees
Labels
No labels