-
Notifications
You must be signed in to change notification settings - Fork 294
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
please support specifying a collection of resolved Resource
instances for the individual schema files for Spring Native usage
#185
Comments
Hey Josh, We haven't experimented much with native so far, so thanks for sharing your experience here. @ResourceHint(patterns = {"graphql/*.graphqls", "graphql/*.gqls"}) This is a short term solution, as it won't stay aligned with the configuration properties if the values are changed. |
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed. |
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue. |
Hi - let me try that out now. I don't think it'll make a difference as I've tried using |
Sorry for the late update: yeeah, this doesn't work. we need to not be doing the scanning, i think. pading @aclement who might know more about why that is, exactly |
I see that since this issue was filed, the autoconfiguration has improved to support conditional registration of the |
Superseded by #495 |
Hi, when I want to use Spring GraphQL in a Spring Native environment, the native build fails at runtime. It cant find the
graphql/schema.graphqls
file. This is because its doing classpath scanning in theGraphqlProperties
class. In Spring Native, there's no classpath.ClassPathResource
s can be made to work by providing Spring Native a configuration hint saying that a particular file is to be included in the native binary's memory, e.g,:graphql/schema.graphqls
, butResourcePatternResolver
doesn't work.So, the simplest solution is to just change the GraphQLProperties to also support a pre-determined array of
graphqls
schema files, instead of the prefix and extension combos.Something like this
Then, a user could easily just say
spring.graphql.schema.schemas=classpath:graphql/schema.graphqls
and it would work in a graalvm spring native app, or they could use the fall through scenario searching for lcoations and extensions on the jreI know this works because I replaced the
GraphQLSource
bean definition in the auto config by copying and pasting the existing bean and then simply hardcoding the return values fromprivate List<Resource> resolveSchemaResources
. Once I did that, and then added the following hint -@ResourceHint(patterns = "graphql/schema.graphqls")
- it built and started up just fine.If you want to reproduce, go to start.spring.io, add the experimental Spring Native support checkbox, add Webflux, and manually add the GraphQL dependency. then run
mvn -Pnative clean package
on a machine with GraalVM (im using the latest, which supports java 17) installed on which you've rungu install native-image
The text was updated successfully, but these errors were encountered: