Adding Custom Controller to DGS graphql framework #286
Unanswered
madhukanth2005
asked this question in
Q&A
Replies: 1 comment 2 replies
-
|
What are you doing with this code? It doesn't seem to be used at all? Other than that, I see no reason why the datafetcher would be called twice. You can try set a breakpoint in this controller, and double check the controller itself isn't called twice for some reason. You could also set a breakpoint in the framework's Conceptually, what you're trying to do should work. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I am new to DGS netflix and we are developing an application Using Spring boot with DGS Netflix graphql. We have created all the schemas and datafethers which is working absolutely fine with a default endpoint "/graphql". we would like to expose this app with custom endpoing and write some common code ,so we are trying to add a controller with a custom endpoint as below (we need to have lot of other logic in controller). But When i run the application and send a query, my data fetcher being called twice . first time called from controller (I think from dgsQueryExecutor.execute() method )and second time i believe from dgs framework it self. Anybody has any thoughts on this why its being called twice and how to avoid it? Also , i would like to set a customContext object while executing (in my case its modelGraphQLContext). Please see the below Datafetcher and Controller for your reference.Your help is highly appreciated. Thank you in advance.
Controller:
@RestController
@RequestMapping("/sample-information/model")
@slf4j
public class CustomController {
}
Datafetcher:
@DgsComponent
@slf4j
public class SampleDataFetcher {
@Autowired
SampleBuilder sampleBuilder;
}
Beta Was this translation helpful? Give feedback.
All reactions