Skip to content

Commit 292becd

Browse files
JordanJLopezPaul BerkmanJordan LopezCopilot
authored
BREAKING CHANGE: Upgrade Spring to 7.x, Spring Boot to 4.x (#2157)
### 📝 Description NOTE: This PR is built off of #2147, and is a superset of that one. That one should be merged first. This pull requests upgrades to the latest Spring Boot and Spring versions. For reference, see https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-4.0-Migration-Guide The change with the biggest impact is the splitting up of certain modules within the Spring Boot ecosystem, requiring that we pull more specific dependencies. #### Jackson Upgrade Delayed https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-4.0-Migration-Guide#upgrading-jackson Spring Boot 4 would prefer that we move to Jackson 3, but we're blocked on that while graphql-java remains on Jackson 2. Therefore we need to ensure that we use the Spring Boot Jackson2 module. **Additionally,** some tests broke when Jackson 3 was included in the classpath, due to an internal Spring flag that checks the classpath: https://github.com/spring-projects/spring-framework/blob/77bc13dc8c4387ad33af274eed39ed2734edce56/spring-websocket/src/main/java/org/springframework/web/socket/sockjs/transport/TransportHandlingSockJsService.java#L74 (The above link indicates the kind of logic, I'm not entirely sure it's the exact spot that was breaking the test). ### 🔗 Related Issues --------- Co-authored-by: Paul Berkman <paul.berkman@microba.com> Co-authored-by: Jordan Lopez <jordlopez@expediagroup.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent 8f93df6 commit 292becd

File tree

45 files changed

+428
-106
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+428
-106
lines changed

.github/workflows/graalvm-integration.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
- name: Setup GraalVM
3131
uses: graalvm/setup-graalvm@v1
3232
with:
33-
java-version: '17'
33+
java-version: '25'
3434
distribution: 'graalvm'
3535
components: 'native-image'
3636
native-image-job-reports: 'true'

buildSrc/src/main/kotlin/com.expediagroup.graphql.conventions.gradle.kts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import org.gradle.accessors.dm.LibrariesForLibs
2-
import org.jetbrains.dokka.gradle.DokkaTask
2+
import org.jetbrains.dokka.gradle.tasks.DokkaGeneratePublicationTask
33
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
44
import java.time.Instant
55

@@ -68,11 +68,11 @@ tasks {
6868
from(sourceSets.main.get().allSource)
6969
}
7070

71-
val dokka = named("dokkaJavadoc", DokkaTask::class)
71+
val dokka = named<DokkaGeneratePublicationTask>("dokkaGeneratePublicationHtml")
7272
val javadocJar by registering(Jar::class) {
73-
archiveClassifier.set("javadoc")
74-
from("${layout.buildDirectory}/dokka/javadoc")
7573
dependsOn(dokka)
74+
archiveClassifier.set("javadoc")
75+
from(dokka.flatMap { it.outputDirectory })
7676
}
7777
publishing {
7878
publications {

clients/graphql-kotlin-spring-client/build.gradle.kts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,16 @@ dependencies {
1818

1919
tasks {
2020
jacocoTestCoverageVerification {
21+
// Exclude synthetic lambda classes inlined from Spring's awaitBody (WebClientExtensions.kt).
22+
// Because awaitBody is a `suspend inline` function in Spring 7, the Kotlin compiler inlines
23+
// its body (including an anonymous Function2 lambda from the withContext block) directly into
24+
// GraphQLWebClient's bytecode. JaCoCo instruments these inlined instructions but cannot find
25+
// their source file (it lives in the Spring JAR), causing false coverage misses.
26+
classDirectories.setFrom(
27+
sourceSets.main.get().output.asFileTree.matching {
28+
exclude("**/GraphQLWebClient\$execute\$suspendImpl\$\$inlined\$awaitBody\$*")
29+
}
30+
)
2131
violationRules {
2232
rule {
2333
limit {

examples/federation/products-subgraph/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ plugins {
1010
dependencies {
1111
implementation("com.expediagroup", "graphql-kotlin-spring-server")
1212
testImplementation(libs.spring.boot.test)
13+
testImplementation(libs.spring.boot.webtestclient)
1314

1415
graphqlSDL("com.expediagroup", "graphql-kotlin-federated-hooks-provider")
1516
}

examples/federation/products-subgraph/src/test/kotlin/com/expediagroup/graphql/examples/federation/products/ProductsApplicationTest.kt

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,23 @@
1717
package com.expediagroup.graphql.examples.federation.products
1818

1919
import com.expediagroup.graphql.server.types.GraphQLRequest
20+
import org.junit.jupiter.api.BeforeEach
2021
import org.junit.jupiter.api.Test
2122
import org.springframework.beans.factory.annotation.Autowired
22-
import org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebTestClient
2323
import org.springframework.boot.test.context.SpringBootTest
24+
import org.springframework.context.ApplicationContext
2425
import org.springframework.http.MediaType
2526
import org.springframework.test.web.reactive.server.WebTestClient
2627

2728
@SpringBootTest
28-
@AutoConfigureWebTestClient
29-
class ProductsApplicationTest(@Autowired val testClient: WebTestClient) {
29+
class ProductsApplicationTest {
30+
31+
private lateinit var testClient: WebTestClient
32+
33+
@BeforeEach
34+
fun setup(@Autowired context: ApplicationContext) {
35+
testClient = WebTestClient.bindToApplicationContext(context).build()
36+
}
3037

3138
@Test
3239
fun `verifies product query`() {

examples/federation/reviews-subgraph/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ plugins {
1010
dependencies {
1111
implementation("com.expediagroup", "graphql-kotlin-spring-server")
1212
testImplementation(libs.spring.boot.test)
13+
testImplementation(libs.spring.boot.webtestclient)
1314

1415
graphqlSDL("com.expediagroup", "graphql-kotlin-federated-hooks-provider")
1516
}

examples/federation/reviews-subgraph/src/test/kotlin/com/expediagroup/graphql/examples/federation/reviews/ReviewsApplicationTest.kt

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,23 @@
1717
package com.expediagroup.graphql.examples.federation.reviews
1818

1919
import com.expediagroup.graphql.server.types.GraphQLRequest
20+
import org.junit.jupiter.api.BeforeEach
2021
import org.junit.jupiter.api.Test
2122
import org.springframework.beans.factory.annotation.Autowired
22-
import org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebTestClient
2323
import org.springframework.boot.test.context.SpringBootTest
24+
import org.springframework.context.ApplicationContext
2425
import org.springframework.http.MediaType
2526
import org.springframework.test.web.reactive.server.WebTestClient
2627

2728
@SpringBootTest
28-
@AutoConfigureWebTestClient
29-
class ReviewsApplicationTest(@Autowired val testClient: WebTestClient) {
29+
class ReviewsApplicationTest {
30+
31+
private lateinit var testClient: WebTestClient
32+
33+
@BeforeEach
34+
fun setup(@Autowired context: ApplicationContext) {
35+
testClient = WebTestClient.bindToApplicationContext(context).build()
36+
}
3037

3138
@Test
3239
fun `verifies product query`() {

examples/server/spring-server/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ dependencies {
1212
implementation("com.expediagroup", "graphql-kotlin-hooks-provider")
1313
implementation(libs.spring.boot.validation)
1414
testImplementation(libs.spring.boot.test)
15+
testImplementation(libs.spring.boot.webtestclient)
1516
testImplementation(libs.reactor.test)
1617
}
1718

examples/server/spring-server/src/test/kotlin/com/expediagroup/graphql/examples/server/spring/mutation/ScalarMutationIT.kt

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,26 @@ import com.expediagroup.graphql.examples.server.spring.DATA_JSON_PATH
2020
import com.expediagroup.graphql.examples.server.spring.GRAPHQL_ENDPOINT
2121
import com.expediagroup.graphql.examples.server.spring.GRAPHQL_MEDIA_TYPE
2222
import com.expediagroup.graphql.examples.server.spring.verifyOnlyDataExists
23+
import org.junit.jupiter.api.BeforeEach
2324
import org.junit.jupiter.api.Test
2425
import org.junit.jupiter.api.TestInstance
2526
import org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS
2627
import org.springframework.beans.factory.annotation.Autowired
27-
import org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebTestClient
2828
import org.springframework.boot.test.context.SpringBootTest
29+
import org.springframework.context.ApplicationContext
2930
import org.springframework.http.MediaType.APPLICATION_JSON
3031
import org.springframework.test.web.reactive.server.WebTestClient
3132

3233
@SpringBootTest
33-
@AutoConfigureWebTestClient
3434
@TestInstance(PER_CLASS)
35-
class ScalarMutationIT(@Autowired private val testClient: WebTestClient) {
35+
class ScalarMutationIT {
36+
37+
private lateinit var testClient: WebTestClient
38+
39+
@BeforeEach
40+
fun setup(@Autowired context: ApplicationContext) {
41+
testClient = WebTestClient.bindToApplicationContext(context).build()
42+
}
3643

3744
@Test
3845
fun `verify addPerson query`() {

examples/server/spring-server/src/test/kotlin/com/expediagroup/graphql/examples/server/spring/mutation/SimpleMutationIT.kt

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,26 @@ import com.expediagroup.graphql.examples.server.spring.GRAPHQL_ENDPOINT
2121
import com.expediagroup.graphql.examples.server.spring.GRAPHQL_MEDIA_TYPE
2222
import com.expediagroup.graphql.examples.server.spring.verifyOnlyDataExists
2323
import org.hamcrest.Matchers
24+
import org.junit.jupiter.api.BeforeEach
2425
import org.junit.jupiter.api.Test
2526
import org.junit.jupiter.api.TestInstance
2627
import org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS
2728
import org.springframework.beans.factory.annotation.Autowired
28-
import org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebTestClient
2929
import org.springframework.boot.test.context.SpringBootTest
30+
import org.springframework.context.ApplicationContext
3031
import org.springframework.http.MediaType.APPLICATION_JSON
3132
import org.springframework.test.web.reactive.server.WebTestClient
3233

3334
@SpringBootTest
34-
@AutoConfigureWebTestClient
3535
@TestInstance(PER_CLASS)
36-
class SimpleMutationIT(@Autowired private val testClient: WebTestClient) {
36+
class SimpleMutationIT {
37+
38+
private lateinit var testClient: WebTestClient
39+
40+
@BeforeEach
41+
fun setup(@Autowired context: ApplicationContext) {
42+
testClient = WebTestClient.bindToApplicationContext(context).build()
43+
}
3744

3845
@Test
3946
fun `verify addToList query`() {

0 commit comments

Comments
 (0)