Hi everyone, has anyone encounter an issue with `s...
# graphql-kotlin
a
Hi everyone, has anyone encounter an issue with
spring-devtool
and
graphql-kotlin-spring-server
when hot-swapping code? The full detail is here https://github.com/ExpediaGroup/graphql-kotlin/issues/730. Essentially it would work fine the first time around, but after you make some changes or just add a simple
println
I get this error
DataFetchingException: Object is not an instance of declaring class
. Would love to know if anyone encounter this and know how to fix this 🙂
d
You could also try asking in #spring
s
I don’t know what the error is for sure, but it sounds like graphql-java may be checking the class hash to verify the output is matching the schema and the reload of the classes does not reload the
GraphQL
class to check the class hash again. I am not familiar with
spring-devtool
but can you have it also reload the spring bean for
GraphQL
when you reload the server?
a
I’m not sure how to make it reload the spring bean as well, because any time you make changes to it it will detect the changes in the classpath and automatically reloads the server. I will check it in the spring channel, but just curious could it be due to classloader issue where the object data is being deserialized? https://docs.spring.io/spring-boot/docs/1.5.16.RELEASE/reference/html/using-boot-devtools.html#using-boot-devtools-known-restart-limitations
d
unsure about those annotations -> but I’d assume
@Secured
will most likely wrap underlying method in a proxy which might be causing the issue
👍 1
r
Seems like spring security and graphql-Kotlin don’t play that nice. Also reactive spring security via Annotations doesn’t like Coroutines yet. AOP would work maybe. But I think implementing a custom directive + graphql context would fit best. graphql-java docs also https://www.graphql-java.com/documentation/v11/sdl-directives/ go this route
d
yeah so while there is reactive spring security I don’t think it plays nice with GraphQL
i’d start with spring security filter but then populate the GraphQL context and use it with directives