graphql-spqr-spring-boot-starter
graphql-spqr-spring-boot-starter copied to clipboard
Unable to upgrade to `Spring Boot` version `2.7.x`
Would it be possible to get a new release some time this year? Currently I'm unable to upgrade to Spring Boot version 2.7.x :grimacing:
I would love to have it too
The issue I get while upgrading to Boot 2.7 is the following exception: org.springframework.beans.BeanInstantiationException: Failed to instantiate [graphql.schema.GraphQLSchema]: Factory method 'graphQLSchema' threw exception; nested exception is java.lang.NoClassDefFoundError: graphql/execution/batched/Batched
It is such a wonderful project, but it is not up-to-date (again). I need to fix it locally to use spring 2.7.
You can fix it in your gradle build like this:
plugins {
id 'org.springframework.boot' version "2.7.3"
// to use ext['graphql-java.version'] this plugin is needed:
id "io.spring.dependency-management" version "1.0.13.RELEASE"
}
// https://github.com/leangen/graphql-spqr-spring-boot-starter/issues/119
ext['graphql-java.version'] = '16.2'
@kicktipp Any maven version for this?
With Spring-Boot 3.0.0 this problem seems to have become even bigger aka its not compatible anymore because spring changed that spring.factories mechanism
With GraphQL SPQR v0.12.0 out the door, I will have a look at the state of this project. But, fair warning, there's a good chance that maintaining it in the current shape in light of the official starter is nonsensical. The easiest way forward may be to build a smaller extension on top of the official starter. But that's currently just a theory. Either way, it will take time to explore the options and see what to do,
If any of you would like to help upgrade this to the latest Spring Boot and SPQR versions, please do.
I see the following issues
- The GraphQL library that is referenced by Boot 2.7 is newer than the one supported with the current product. To align both, you'll have to bump the
spqr.versionfirst - There are some deprecation warnings, that are easily fixed as far as I can tell
A necessary change is to adapt how the auto configuration is loaded. Spring Boot 2.7 supports the old way (with spring.factories) and the new way (with org.springframework.boot.autoconfigure.AutoConfiguration.imports plus using now @AutoConfiguration, with the latter not allowing to proxy @Bean methods anymore, but you are doing that anyway).
I'll send a PR in a sec addressing these things. Feel free to edit whatever you want, especially my changes unrelated to auto config (I don't have a clue honestly how the SPQR / GraphQL system works, I'm just here with my dear colleague @SaschaPeukert). The remaining changes to auto config are sane and will allow proper usage in at least Boot 2.7 and most likely with Boot 3 (given that the GraphQL version is compatible).
Thanks a bunch for this! 😊 It's of great help! There seems to be one place where bean method proxying was unfortunately used, but I'm not sure why... I'll have a look in a second.
You made the configurational class bean on its own and you can't auto inject into the overloaded method. I pushed this down, so that the configurer is a bean on its own rights, inject the executor. That should work.