philip-jvm / learn-spring-boot-graphql Goto Github PK
View Code? Open in Web Editor NEWSource code to help learn the kickstarter spring-boot-graphql library
Home Page: https://www.youtube.com/playlist?list=PLiwhu8iLxKwL1TU0RMM6z7TtkyW-3-5Wi
Source code to help learn the kickstarter spring-boot-graphql library
Home Page: https://www.youtube.com/playlist?list=PLiwhu8iLxKwL1TU0RMM6z7TtkyW-3-5Wi
Hi Philip,
Thanks for all the tricks and help you provided in these tutorials. I am doing some work to consume httpservletrequest. And for the same I used your provided CustomGraphQLContext. But while initializing this I am getting below error. Can you please help here as I am not sure why I am getting this error.
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'optionsBuilder' defined in class path resource [graphql/kickstart/tools/boot/GraphQLJavaToolsAutoConfiguration.class]: Post-processing of merged bean definition failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [graphql.kickstart.tools.SchemaParserOptions$Builder] from ClassLoader [sun.misc.Launcher$AppClassLoader@73d16e93]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:846) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:863) ~[spring-context-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546) ~[spring-context-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142) ~[spring-boot-2.1.1.RELEASE.jar:2.1.1.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) [spring-boot-2.1.1.RELEASE.jar:2.1.1.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.1.1.RELEASE.jar:2.1.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) [spring-boot-2.1.1.RELEASE.jar:2.1.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) [spring-boot-2.1.1.RELEASE.jar:2.1.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) [spring-boot-2.1.1.RELEASE.jar:2.1.1.RELEASE]
at com.kushagra.spring.graphql.api.SpringGraphqlApplication.main(SpringGraphqlApplication.java:10) [classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_201]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_201]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_201]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_201]
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [spring-boot-devtools-2.1.1.RELEASE.jar:2.1.1.RELEASE]
Caused by: java.lang.IllegalStateException: Failed to introspect Class [graphql.kickstart.tools.SchemaParserOptions$Builder] from ClassLoader [sun.misc.Launcher$AppClassLoader@73d16e93]
at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:686) ~[spring-core-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.util.ReflectionUtils.doWithLocalMethods(ReflectionUtils.java:546) ~[spring-core-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.buildPersistenceMetadata(PersistenceAnnotationBeanPostProcessor.java:432) ~[spring-orm-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findPersistenceMetadata(PersistenceAnnotationBeanPostProcessor.java:406) ~[spring-orm-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(PersistenceAnnotationBeanPostProcessor.java:333) ~[spring-orm-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyMergedBeanDefinitionPostProcessors(AbstractAutowireCapableBeanFactory.java:1044) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:550) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE]
... 20 common frames omitted
Caused by: java.lang.NoClassDefFoundError: kotlin/coroutines/CoroutineContext
at java.lang.Class.getDeclaredMethods0(Native Method) ~[na:1.8.0_201]
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) ~[na:1.8.0_201]
at java.lang.Class.getDeclaredMethods(Class.java:1975) ~[na:1.8.0_201]
at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:668) ~[spring-core-5.1.3.RELEASE.jar:5.1.3.RELEASE]
... 26 common frames omitted
Caused by: java.lang.ClassNotFoundException: kotlin.coroutines.CoroutineContext
at java.net.URLClassLoader.findClass(URLClassLoader.java:382) ~[na:1.8.0_201]
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_201]
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349) ~[na:1.8.0_201]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_201]
... 30 common frames omitted
Hi Philip,
first of all maximum kudos for your great series, it's imho the best resource on Spring Boot with GraphQL around.
So, for our project we just tried to use the subscription authorization implementation of your project. Our goal is to handle multitenancy awareness of subscriptions.
Everything with the subscription works fine, so we can grab whatever we pass in as params when establishing the ws connection and save that to the SubscriptionSession
. However when trying to fetch context params in the subscription resolver when calling
GraphQLWebSocketContext context = getContext(e);
in BankAccountSubscription.bankAccount(UUID id, DataFetchingEnvironment e)
you'll get a ClassCastException
.
The reason is that it's giving you an instance of GraphQLServletContext
instead of a GraphQLWebSocketContext
.
When debugging your project (no changes at all except added cors handling in the filter chain) it shows the same behaviour. I wonder how this can be since everything works out fine in your video. Since I did change nothing in the code I have no explanation why it's not working. Can you (or anybody else) reproduce that and/or give me any hint what's wrong?
Tested with Chrome v. 94.0.4606.71 and the GraphQL Playground extension (same that you use in your videos) on Mac OS X Big Sur 11.6.
Thanks in advance for any help on this.
You have a video where you speak about DDOS and the max query depth.
I have the same problem as a user who set the following problem under Kickstarter:
graphql-java-kickstart/graphql-spring-boot#609
I took part in the discussion. I saw that Playground in your sample has also no connection to the graphql Backend but you execute the queries an get back the right exception. I use the actual version 11.0. Do you have some experience with the same problem which you can share withn us?
Hi Philip, great material on https://www.youtube.com/playlist?list=PLiwhu8iLxKwL1TU0RMM6z7TtkyW-3-5Wi
Would you be open to the idea of having your Tutorial series referenced on https://www.graphql-java-kickstart.com/
Hi Philip,
Thanks for your youtube videos series. They helped me to understand graphql.
I am struggling about dataloader registry. In my project I want to register multiple data loader registry. How can I do that.
In CustomGraphQLContextBuilder; I can only register one factory. I want to do it for multiple.
Thank you
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.