graphql-spqr-spring-boot-starter icon indicating copy to clipboard operation
graphql-spqr-spring-boot-starter copied to clipboard

Unable to upgrade to `Spring Boot` version `2.7.x`

Open x80486 opened this issue 3 years ago • 4 comments

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:

x80486 avatar Jun 15 '22 14:06 x80486

I would love to have it too

MarcinLachowicz avatar Jun 28 '22 08:06 MarcinLachowicz

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

vmikhnevych avatar Jul 01 '22 14:07 vmikhnevych

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.

kicktipp avatar Aug 24 '22 14:08 kicktipp

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 avatar Sep 04 '22 16:09 kicktipp

@kicktipp Any maven version for this?

SaschaPeukert avatar Nov 28 '22 15:11 SaschaPeukert

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

SaschaPeukert avatar Nov 28 '22 15:11 SaschaPeukert

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,

kaqqao avatar Nov 28 '22 16:11 kaqqao

If any of you would like to help upgrade this to the latest Spring Boot and SPQR versions, please do.

kaqqao avatar Nov 28 '22 16:11 kaqqao

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.version first
  • 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).

michael-simons avatar Nov 29 '22 10:11 michael-simons

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.

kaqqao avatar Nov 30 '22 14:11 kaqqao

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.

michael-simons avatar Nov 30 '22 14:11 michael-simons