-
Notifications
You must be signed in to change notification settings - Fork 175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failed to start SpringBoot Application after addition of GraphQLQueryResolver #157
Comments
Sounds like a "No graphql schema files found on classpath with location pattern '**/*.graphqls'. Please add a graphql schema to the classpath or add a SchemaParser bean to your application context." So where did you store your schema file? |
I have stored in /src/main/resources/dockets.graphql which is in classpath Also when I remove class which is using GraphQLQueryResolver , there is no issue and Sprint Boot runs fine with the schema provided
|
As indicated by the error message you either need to rename that schema file to |
Initially I named it as above but still the same issue . I did not get schema location pattern as without |
Then this information alone isn't sufficient to properly determine what could be causing this. Are you able to share the minimal configuration to reproduce this issue? |
@oliemansm Thanks for your support. I am a bit confused about GraphQLQueryResolver and loadschema where you follow following code and make use of DataFetchers
So which one is the right approach? Do you have any sample example which make use of GraphQLQueryResolver ? |
When you're using
If you take a look at example-graphql-tools you will notice this same approach. |
@oliemansm public ResponseEntity getPersonById(@requestbody String query) { |
I don't understand what you're trying to do here... |
@oliemansm
So this is what I am doing , I am not able to understand how to use resolvers to get the api implementation done Also whenever I write any resolver , my spring boot application fails with exception I listed above So how to use revolvers with Spring boot controller Request Mapping |
Try removing your dependency on But why are you making it this complicated for yourself? Looks like you're trying to expose specific endpoints for specific queries, but as it's written now it leads to a duplication of code with both methods doing exactly the same thing which doesn't necessarily correspond to what the method names imply. Because sending the same So it's basically the same as if you were to send it to |
@oliemansm But I dont wnat to have /graphql as my endpoint exposed to the consumer Is there any way to make use of resolvers with Spring Boot Rest Controller methods ? |
You do realize your methods Example for creating the schema manually: private void createGraphQL() throws IOException {
GraphQLSchema schema = SchemaParser.newParser()
.schemaString(readSchema())
.resolvers(new Query(),
new Mutation(mockedAreaFacade, mockedTokenAuthenticationService,
mockedDataCollectionService, mockedPresetService, mockedItemDefinitionImporter,
mockedItemService),
new ViewerResolver(mockedItemFacade, mockedUserFacade, mockedPresetService,
mockedShapefileFacade),
new PresetItemResolver(mockedGeometryService, mockedItemService, mockedPresetService),
new ItemResolver(mockedItemService, mockedPropertyService),
new DirectoryResolver(mockedItemService))
.dictionary(createDictionary().getDictionary())
.scalars(new GraphQLScalarType("DateTime", "", new DateTimeCoercing()))
.build()
.makeExecutableSchema();
graphQL = GraphQL.newGraphQL(schema).build();
} As stated, I'd replace the |
@oliemansm Thanks for your support. |
That's all described in the readme of |
I have tried using
But is still GraphQL is not getting exposed on a different endpoint I did not see any which way where /graphql van be exposed to some other point Also /graphql is giving 400 bad request, it is only expecting query parameters Only /graphiql is working which is a html page How can we expose /graphql as as endpoint with post body? |
I'm seeing that too now, that looks like a bug then. Could you close this issue here and raise a new issue on the |
Ok |
@oliemansm Hi, i just read this conversation as i encountered the same issue reported by @sharmmoh1983. Removing the following dependency resolved my issue Thanks. |
Thank you. This resolved the issue |
It can be too late comment. In my case version of springboot and graphql is issue. When I use springboot 1.5.9 and graphql 5.0.2, I have same problem with you. But when I upgrade springboot version to 2.0.4 the error is gone. |
I am facing the same error again. But the difference is that - my application runs fine normally, but when I run integration tests (using spring boot's @SpringBootTest and @ContextConfiguration) then I face the below exception: |
@jeet23 |
How can i add the resource path in application.properities?? |
The text was updated successfully, but these errors were encountered: