https://kotlinlang.org logo
#graphql-kotlin
Title
# graphql-kotlin
r

Robert

05/20/2022, 7:58 AM
Does graphlq-kotlin work with spring 2.7.0? I’m using 5.4.1 https://github.com/rowi1de/graphql-reactive/runs/6516519218?check_suite_focus=true#step:5:66
Copy code
Caused by: java.lang.ClassCastException at SchemaPrinter.java:762
d

Dariusz Kuc

05/20/2022, 2:21 PM
@Saurav Tapader just opened up a PR to bump the dependencies (including spring boot 2.7)
❤️ 1
s

Saurav Tapader

05/20/2022, 2:21 PM
needs some approval
d

Dariusz Kuc

05/20/2022, 3:06 PM
that being said -> schema printer is from
graphql-java
so it kind of looks like you got classpath problem with
graphql-java
and not spring
🤔 1
r

Robert

05/20/2022, 6:46 PM
I only include implementation("com.expediagroupgraphql kotlin spring server5.4.1")
d

Dariusz Kuc

05/20/2022, 7:03 PM
hmm unsure then, it certainly does look like some classpath issue ->
graphql-kotlin 5.4.1
depends on
graphql-java 17.2
but it only increments count in the schema printer (https://github.com/graphql-java/graphql-java/blob/v17.2/src/main/java/graphql/schema/idl/SchemaPrinter.java#L762) In the latest
graphql-java
(18.1) it attempts to get list of predicates -> https://github.com/graphql-java/graphql-java/blob/v18.1/src/main/java/graphql/schema/idl/SchemaPrinter.java#L762 which used to be
Predicate<GraphQLDirective>
(in old version) and are now just
Predicate<String>
we have pre-release versions out that bump the
graphql-java
dependency to
18.1
so you could try that
latest ->
6.0.0-alpha.4
r

Robert

05/20/2022, 7:07 PM
Thanks for the hint, worth a try. It's just a demo project with automated dependabot PRs, which just bumped spring from 2.6.7 to 2.7.0. Spring now has an own grapql starter based on graphql-java .. maybe this is messing up something?
d

Dariusz Kuc

05/20/2022, 7:10 PM
indeed good callout
yeah thats probably it
r

Robert

05/20/2022, 7:12 PM
I don't include that starter but could think something in spring boot itself could do some autoconfiguration because some graphql-java is on the classpath… just guessing, would need to check later
d

Dariusz Kuc

05/20/2022, 7:31 PM
try debugging your classpath to see where it comes from
r

Robert

05/20/2022, 8:16 PM
Copy code
id("io.spring.dependency-management") version "1.0.11.RELEASE"
here it comes from
Copy code
com.expediagroup:graphql-kotlin-spring-server:6.0.0-alpha.4
works again
d

Dariusz Kuc

05/20/2022, 8:37 PM
I dont think you need the spring dep management plugin (wasnt this an old deprecated way? I think you can import boms using
platform
dep)
r

Robert

05/20/2022, 9:44 PM
https://start.spring.io/#!type=gradle-project&amp;language=kotlin&amp;platformVersion=2.7.0&amp;packaging=jar&amp;jvmVersion=17&amp;groupId=com.example&amp;artifactId=demo&amp;name=demo&amp;description=Demo%20project%20for%20Spring%20Boot&amp;packageName=com.example.demo<https://start.spring.io/#!type=gradle-project&language=kotlin&platformVersion=2.7.0&packaging=jar&jvmVersion=17&groupId=com.example&artifactId=demo&name=demo&description=Demo%20project%20for%20Spring%20Boot&packageName=com.example.demo|
I think it's up to date
d

Dariusz Kuc

05/20/2022, 10:05 PM
Yeah they still publish it but I think using bom natively (through platform) is generally preferred option
r

Robert

05/21/2022, 8:06 AM
That would make it easier, good to know 👍🏻
6 Views