-
Notifications
You must be signed in to change notification settings - Fork 96
Support for singletons? GraphQLAnnotations.object(mySingleton) #187
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
Comments
I'm using the annotations library in this particular way in one of my projects (using spring boot). |
Can you show me how this works? Some small piece of example code, where you use an The tests of this project and the spring boot starter project don't seem to include any examples for this. Or did I overlook something? |
If you want to use
And that way you can use spring stuff inside your dataFetcher |
I already thought that you had used But the solution is in the end not very "Springish". I know that this is not your graphql-spring project, but the spring project depends on the graphql-annotations project when it comes to collecting and configuring the graphql types. Though I thought it might be nice, if this library could also work with singleton beans, and not only with classes. |
I had this exact problem yesterday. I found this very nicely documented library which already supports these use cases, https://github.com/leangen/graphql-spqr. This is a sample app that shows the whole thing wired up with spring-boot, https://github.com/leangen/graphql-spqr-samples/tree/master/spring-boot-sample. Also note there's a spring-boot-starter which does some of the work for you (although in honesty there's not much to do either way). |
Hi @benneq, We're helping with project maintenance and reviewing the list of opened PRs and Issues. This issue was created quite a while ago, we were wondering if you were still interested in the outcome, please let us know if this is the case. Without an answer by July 1st, 2023, this issue will be closed as "inactive" (and can always be re-opened later on if needed). Thanks, |
@Fgerthoffert I haven't looked into this for years. Though if nobody else here is still interested, you may just close this. |
Uh oh!
There was an error while loading. Please reload this page.
Is it somehow possible to use objects instead of classes?
I want to use
graphql-java-annotations
with Spring Dependency Injection.I want to use something like the following code:
This way I could inject for example a Service into
MyQueryBean
for Database access:Is this already possible somehow?
The text was updated successfully, but these errors were encountered: