From a44c836fc0d10854c2a4b74e7226de54e42a4acf Mon Sep 17 00:00:00 2001 From: Brian Clozel Date: Tue, 15 Sep 2020 13:28:55 +0200 Subject: [PATCH] Merge modules This commit merges the common, webmvc and webflux modules into a single web module for supporting GraphQL with all Spring web frameworks. We're working here with optional dependencies to build the support for Spring MVC on one side and Spring WebFlux on the other. Also, this commit updates the starter modules to adopt the official naming convention. For now, starter modules will host both the configuration infrastructure and the transitive dependencies to activate support. --- settings.gradle | 9 +++------ spring-boot-starter-graphql-web/build.gradle | 7 +++++++ .../servlet/GraphQLEndpointConfiguration.java | 0 .../graphql/servlet/package-info.java | 0 .../src/main/resources/META-INF/spring.factories | 0 .../graphql/servlet/IntegrationTest.java | 0 .../graphql/servlet/IntegrationTestConfig.java | 0 spring-boot-starter-graphql-webflux/build.gradle | 6 ++++++ .../reactive/GraphQLEndpointConfiguration.java | 0 .../graphql/reactive/package-info.java | 0 .../src/main/resources/META-INF/spring.factories | 0 .../graphql/reactive/IntegrationTest.java | 0 .../graphql/reactive/IntegrationTestConfig.java | 0 spring-graphql-boot-starter-webflux/build.gradle | 9 --------- spring-graphql-boot-starter-webmvc/build.gradle | 9 --------- spring-graphql-common/build.gradle | 7 ------- spring-graphql-web/build.gradle | 16 ++++++++++++++++ .../graphql/DefaultGraphQLInterceptor.java | 0 .../springframework/graphql/GraphQLHandler.java | 0 .../graphql/GraphQLHttpRequest.java | 0 .../graphql/GraphQLHttpResponse.java | 0 .../graphql/GraphQLInterceptor.java | 0 .../springframework/graphql/package-info.java | 0 .../reactive/components/GraphQLController.java | 0 .../components/GraphQLReactiveRequestBody.java | 0 .../reactive/components/package-info.java | 0 .../servlet/components/GraphQLController.java | 0 .../components/GraphQLServletRequestBody.java | 0 .../graphql/servlet/components/package-info.java | 0 spring-graphql-webflux/build.gradle | 10 ---------- spring-graphql-webmvc/build.gradle | 10 ---------- 31 files changed, 32 insertions(+), 51 deletions(-) create mode 100644 spring-boot-starter-graphql-web/build.gradle rename {spring-graphql-boot-starter-webmvc => spring-boot-starter-graphql-web}/src/main/java/org/springframework/graphql/servlet/GraphQLEndpointConfiguration.java (100%) rename {spring-graphql-boot-starter-webmvc => spring-boot-starter-graphql-web}/src/main/java/org/springframework/graphql/servlet/package-info.java (100%) rename {spring-graphql-boot-starter-webmvc => spring-boot-starter-graphql-web}/src/main/resources/META-INF/spring.factories (100%) rename {spring-graphql-boot-starter-webmvc => spring-boot-starter-graphql-web}/src/test/java/org/springframework/graphql/servlet/IntegrationTest.java (100%) rename {spring-graphql-boot-starter-webmvc => spring-boot-starter-graphql-web}/src/test/java/org/springframework/graphql/servlet/IntegrationTestConfig.java (100%) create mode 100644 spring-boot-starter-graphql-webflux/build.gradle rename {spring-graphql-boot-starter-webflux => spring-boot-starter-graphql-webflux}/src/main/java/org/springframework/graphql/reactive/GraphQLEndpointConfiguration.java (100%) rename {spring-graphql-boot-starter-webflux => spring-boot-starter-graphql-webflux}/src/main/java/org/springframework/graphql/reactive/package-info.java (100%) rename {spring-graphql-boot-starter-webflux => spring-boot-starter-graphql-webflux}/src/main/resources/META-INF/spring.factories (100%) rename {spring-graphql-boot-starter-webflux => spring-boot-starter-graphql-webflux}/src/test/java/org/springframework/graphql/reactive/IntegrationTest.java (100%) rename {spring-graphql-boot-starter-webflux => spring-boot-starter-graphql-webflux}/src/test/java/org/springframework/graphql/reactive/IntegrationTestConfig.java (100%) delete mode 100644 spring-graphql-boot-starter-webflux/build.gradle delete mode 100644 spring-graphql-boot-starter-webmvc/build.gradle delete mode 100644 spring-graphql-common/build.gradle create mode 100644 spring-graphql-web/build.gradle rename {spring-graphql-common => spring-graphql-web}/src/main/java/org/springframework/graphql/DefaultGraphQLInterceptor.java (100%) rename {spring-graphql-common => spring-graphql-web}/src/main/java/org/springframework/graphql/GraphQLHandler.java (100%) rename {spring-graphql-common => spring-graphql-web}/src/main/java/org/springframework/graphql/GraphQLHttpRequest.java (100%) rename {spring-graphql-common => spring-graphql-web}/src/main/java/org/springframework/graphql/GraphQLHttpResponse.java (100%) rename {spring-graphql-common => spring-graphql-web}/src/main/java/org/springframework/graphql/GraphQLInterceptor.java (100%) rename {spring-graphql-common => spring-graphql-web}/src/main/java/org/springframework/graphql/package-info.java (100%) rename {spring-graphql-webflux => spring-graphql-web}/src/main/java/org/springframework/graphql/reactive/components/GraphQLController.java (100%) rename {spring-graphql-webflux => spring-graphql-web}/src/main/java/org/springframework/graphql/reactive/components/GraphQLReactiveRequestBody.java (100%) rename {spring-graphql-webflux => spring-graphql-web}/src/main/java/org/springframework/graphql/reactive/components/package-info.java (100%) rename {spring-graphql-webmvc => spring-graphql-web}/src/main/java/org/springframework/graphql/servlet/components/GraphQLController.java (100%) rename {spring-graphql-webmvc => spring-graphql-web}/src/main/java/org/springframework/graphql/servlet/components/GraphQLServletRequestBody.java (100%) rename {spring-graphql-webmvc => spring-graphql-web}/src/main/java/org/springframework/graphql/servlet/components/package-info.java (100%) delete mode 100644 spring-graphql-webflux/build.gradle delete mode 100644 spring-graphql-webmvc/build.gradle diff --git a/settings.gradle b/settings.gradle index 877f75a7..afac47e7 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,7 +1,4 @@ rootProject.name = 'spring-graphql' -include 'spring-graphql-boot-starter-webmvc' -include 'spring-graphql-boot-starter-webflux' -include 'spring-graphql-webmvc' -include 'spring-graphql-webflux' -include 'spring-graphql-common' - +include 'spring-boot-starter-graphql-web' +include 'spring-boot-starter-graphql-webflux' +include 'spring-graphql-web' diff --git a/spring-boot-starter-graphql-web/build.gradle b/spring-boot-starter-graphql-web/build.gradle new file mode 100644 index 00000000..aba33a6c --- /dev/null +++ b/spring-boot-starter-graphql-web/build.gradle @@ -0,0 +1,7 @@ +description = "Starter for building GraphQL Java applications with Spring MVC" + +dependencies { + api project(':spring-graphql-web') + api 'io.projectreactor:reactor-core' + api 'org.springframework.boot:spring-boot-starter-web' +} diff --git a/spring-graphql-boot-starter-webmvc/src/main/java/org/springframework/graphql/servlet/GraphQLEndpointConfiguration.java b/spring-boot-starter-graphql-web/src/main/java/org/springframework/graphql/servlet/GraphQLEndpointConfiguration.java similarity index 100% rename from spring-graphql-boot-starter-webmvc/src/main/java/org/springframework/graphql/servlet/GraphQLEndpointConfiguration.java rename to spring-boot-starter-graphql-web/src/main/java/org/springframework/graphql/servlet/GraphQLEndpointConfiguration.java diff --git a/spring-graphql-boot-starter-webmvc/src/main/java/org/springframework/graphql/servlet/package-info.java b/spring-boot-starter-graphql-web/src/main/java/org/springframework/graphql/servlet/package-info.java similarity index 100% rename from spring-graphql-boot-starter-webmvc/src/main/java/org/springframework/graphql/servlet/package-info.java rename to spring-boot-starter-graphql-web/src/main/java/org/springframework/graphql/servlet/package-info.java diff --git a/spring-graphql-boot-starter-webmvc/src/main/resources/META-INF/spring.factories b/spring-boot-starter-graphql-web/src/main/resources/META-INF/spring.factories similarity index 100% rename from spring-graphql-boot-starter-webmvc/src/main/resources/META-INF/spring.factories rename to spring-boot-starter-graphql-web/src/main/resources/META-INF/spring.factories diff --git a/spring-graphql-boot-starter-webmvc/src/test/java/org/springframework/graphql/servlet/IntegrationTest.java b/spring-boot-starter-graphql-web/src/test/java/org/springframework/graphql/servlet/IntegrationTest.java similarity index 100% rename from spring-graphql-boot-starter-webmvc/src/test/java/org/springframework/graphql/servlet/IntegrationTest.java rename to spring-boot-starter-graphql-web/src/test/java/org/springframework/graphql/servlet/IntegrationTest.java diff --git a/spring-graphql-boot-starter-webmvc/src/test/java/org/springframework/graphql/servlet/IntegrationTestConfig.java b/spring-boot-starter-graphql-web/src/test/java/org/springframework/graphql/servlet/IntegrationTestConfig.java similarity index 100% rename from spring-graphql-boot-starter-webmvc/src/test/java/org/springframework/graphql/servlet/IntegrationTestConfig.java rename to spring-boot-starter-graphql-web/src/test/java/org/springframework/graphql/servlet/IntegrationTestConfig.java diff --git a/spring-boot-starter-graphql-webflux/build.gradle b/spring-boot-starter-graphql-webflux/build.gradle new file mode 100644 index 00000000..718f62dc --- /dev/null +++ b/spring-boot-starter-graphql-webflux/build.gradle @@ -0,0 +1,6 @@ +description = "Starter for building GraphQL Java applications with Spring WebFlux" + +dependencies { + api project(':spring-graphql-web') + api 'org.springframework.boot:spring-boot-starter-webflux' +} diff --git a/spring-graphql-boot-starter-webflux/src/main/java/org/springframework/graphql/reactive/GraphQLEndpointConfiguration.java b/spring-boot-starter-graphql-webflux/src/main/java/org/springframework/graphql/reactive/GraphQLEndpointConfiguration.java similarity index 100% rename from spring-graphql-boot-starter-webflux/src/main/java/org/springframework/graphql/reactive/GraphQLEndpointConfiguration.java rename to spring-boot-starter-graphql-webflux/src/main/java/org/springframework/graphql/reactive/GraphQLEndpointConfiguration.java diff --git a/spring-graphql-boot-starter-webflux/src/main/java/org/springframework/graphql/reactive/package-info.java b/spring-boot-starter-graphql-webflux/src/main/java/org/springframework/graphql/reactive/package-info.java similarity index 100% rename from spring-graphql-boot-starter-webflux/src/main/java/org/springframework/graphql/reactive/package-info.java rename to spring-boot-starter-graphql-webflux/src/main/java/org/springframework/graphql/reactive/package-info.java diff --git a/spring-graphql-boot-starter-webflux/src/main/resources/META-INF/spring.factories b/spring-boot-starter-graphql-webflux/src/main/resources/META-INF/spring.factories similarity index 100% rename from spring-graphql-boot-starter-webflux/src/main/resources/META-INF/spring.factories rename to spring-boot-starter-graphql-webflux/src/main/resources/META-INF/spring.factories diff --git a/spring-graphql-boot-starter-webflux/src/test/java/org/springframework/graphql/reactive/IntegrationTest.java b/spring-boot-starter-graphql-webflux/src/test/java/org/springframework/graphql/reactive/IntegrationTest.java similarity index 100% rename from spring-graphql-boot-starter-webflux/src/test/java/org/springframework/graphql/reactive/IntegrationTest.java rename to spring-boot-starter-graphql-webflux/src/test/java/org/springframework/graphql/reactive/IntegrationTest.java diff --git a/spring-graphql-boot-starter-webflux/src/test/java/org/springframework/graphql/reactive/IntegrationTestConfig.java b/spring-boot-starter-graphql-webflux/src/test/java/org/springframework/graphql/reactive/IntegrationTestConfig.java similarity index 100% rename from spring-graphql-boot-starter-webflux/src/test/java/org/springframework/graphql/reactive/IntegrationTestConfig.java rename to spring-boot-starter-graphql-webflux/src/test/java/org/springframework/graphql/reactive/IntegrationTestConfig.java diff --git a/spring-graphql-boot-starter-webflux/build.gradle b/spring-graphql-boot-starter-webflux/build.gradle deleted file mode 100644 index 4494fac1..00000000 --- a/spring-graphql-boot-starter-webflux/build.gradle +++ /dev/null @@ -1,9 +0,0 @@ -description = "Starter for building GraphQL Java applications with Spring WebFlux" - -dependencies { - implementation project(':spring-graphql-webflux') - implementation 'org.springframework.boot:spring-boot-autoconfigure' - - testCompile 'org.springframework.boot:spring-boot-starter-test' - testCompile 'org.springframework.boot:spring-boot-starter-webflux' -} diff --git a/spring-graphql-boot-starter-webmvc/build.gradle b/spring-graphql-boot-starter-webmvc/build.gradle deleted file mode 100644 index 02dd129c..00000000 --- a/spring-graphql-boot-starter-webmvc/build.gradle +++ /dev/null @@ -1,9 +0,0 @@ -description = "Starter for building GraphQL Java applications with Spring WebFlux" - -dependencies { - implementation project(':spring-graphql-webmvc') - implementation 'org.springframework.boot:spring-boot-autoconfigure' - - testCompile 'org.springframework.boot:spring-boot-starter-test' - testCompile 'org.springframework.boot:spring-boot-starter-web' -} diff --git a/spring-graphql-common/build.gradle b/spring-graphql-common/build.gradle deleted file mode 100644 index 3cf49eaf..00000000 --- a/spring-graphql-common/build.gradle +++ /dev/null @@ -1,7 +0,0 @@ -description = "Common module for GraphQL Java Spring support" - -dependencies { - api 'io.projectreactor:reactor-core' - api "com.graphql-java:graphql-java" - implementation "org.springframework:spring-web" -} diff --git a/spring-graphql-web/build.gradle b/spring-graphql-web/build.gradle new file mode 100644 index 00000000..a7da2ac3 --- /dev/null +++ b/spring-graphql-web/build.gradle @@ -0,0 +1,16 @@ +description = "GraphQL Java support with Spring Web frameworks" + +dependencies { + api "com.graphql-java:graphql-java" + + compileOnly "org.springframework:spring-context" + compileOnly "org.springframework:spring-webflux" + + compileOnly 'org.springframework:spring-webmvc' + compileOnly 'javax.servlet:javax.servlet-api' + + testImplementation "com.fasterxml.jackson.core:jackson-databind" + testImplementation "org.springframework:spring-webflux" + testImplementation 'org.springframework:spring-webmvc' + testImplementation 'javax.servlet:javax.servlet-api' +} \ No newline at end of file diff --git a/spring-graphql-common/src/main/java/org/springframework/graphql/DefaultGraphQLInterceptor.java b/spring-graphql-web/src/main/java/org/springframework/graphql/DefaultGraphQLInterceptor.java similarity index 100% rename from spring-graphql-common/src/main/java/org/springframework/graphql/DefaultGraphQLInterceptor.java rename to spring-graphql-web/src/main/java/org/springframework/graphql/DefaultGraphQLInterceptor.java diff --git a/spring-graphql-common/src/main/java/org/springframework/graphql/GraphQLHandler.java b/spring-graphql-web/src/main/java/org/springframework/graphql/GraphQLHandler.java similarity index 100% rename from spring-graphql-common/src/main/java/org/springframework/graphql/GraphQLHandler.java rename to spring-graphql-web/src/main/java/org/springframework/graphql/GraphQLHandler.java diff --git a/spring-graphql-common/src/main/java/org/springframework/graphql/GraphQLHttpRequest.java b/spring-graphql-web/src/main/java/org/springframework/graphql/GraphQLHttpRequest.java similarity index 100% rename from spring-graphql-common/src/main/java/org/springframework/graphql/GraphQLHttpRequest.java rename to spring-graphql-web/src/main/java/org/springframework/graphql/GraphQLHttpRequest.java diff --git a/spring-graphql-common/src/main/java/org/springframework/graphql/GraphQLHttpResponse.java b/spring-graphql-web/src/main/java/org/springframework/graphql/GraphQLHttpResponse.java similarity index 100% rename from spring-graphql-common/src/main/java/org/springframework/graphql/GraphQLHttpResponse.java rename to spring-graphql-web/src/main/java/org/springframework/graphql/GraphQLHttpResponse.java diff --git a/spring-graphql-common/src/main/java/org/springframework/graphql/GraphQLInterceptor.java b/spring-graphql-web/src/main/java/org/springframework/graphql/GraphQLInterceptor.java similarity index 100% rename from spring-graphql-common/src/main/java/org/springframework/graphql/GraphQLInterceptor.java rename to spring-graphql-web/src/main/java/org/springframework/graphql/GraphQLInterceptor.java diff --git a/spring-graphql-common/src/main/java/org/springframework/graphql/package-info.java b/spring-graphql-web/src/main/java/org/springframework/graphql/package-info.java similarity index 100% rename from spring-graphql-common/src/main/java/org/springframework/graphql/package-info.java rename to spring-graphql-web/src/main/java/org/springframework/graphql/package-info.java diff --git a/spring-graphql-webflux/src/main/java/org/springframework/graphql/reactive/components/GraphQLController.java b/spring-graphql-web/src/main/java/org/springframework/graphql/reactive/components/GraphQLController.java similarity index 100% rename from spring-graphql-webflux/src/main/java/org/springframework/graphql/reactive/components/GraphQLController.java rename to spring-graphql-web/src/main/java/org/springframework/graphql/reactive/components/GraphQLController.java diff --git a/spring-graphql-webflux/src/main/java/org/springframework/graphql/reactive/components/GraphQLReactiveRequestBody.java b/spring-graphql-web/src/main/java/org/springframework/graphql/reactive/components/GraphQLReactiveRequestBody.java similarity index 100% rename from spring-graphql-webflux/src/main/java/org/springframework/graphql/reactive/components/GraphQLReactiveRequestBody.java rename to spring-graphql-web/src/main/java/org/springframework/graphql/reactive/components/GraphQLReactiveRequestBody.java diff --git a/spring-graphql-webflux/src/main/java/org/springframework/graphql/reactive/components/package-info.java b/spring-graphql-web/src/main/java/org/springframework/graphql/reactive/components/package-info.java similarity index 100% rename from spring-graphql-webflux/src/main/java/org/springframework/graphql/reactive/components/package-info.java rename to spring-graphql-web/src/main/java/org/springframework/graphql/reactive/components/package-info.java diff --git a/spring-graphql-webmvc/src/main/java/org/springframework/graphql/servlet/components/GraphQLController.java b/spring-graphql-web/src/main/java/org/springframework/graphql/servlet/components/GraphQLController.java similarity index 100% rename from spring-graphql-webmvc/src/main/java/org/springframework/graphql/servlet/components/GraphQLController.java rename to spring-graphql-web/src/main/java/org/springframework/graphql/servlet/components/GraphQLController.java diff --git a/spring-graphql-webmvc/src/main/java/org/springframework/graphql/servlet/components/GraphQLServletRequestBody.java b/spring-graphql-web/src/main/java/org/springframework/graphql/servlet/components/GraphQLServletRequestBody.java similarity index 100% rename from spring-graphql-webmvc/src/main/java/org/springframework/graphql/servlet/components/GraphQLServletRequestBody.java rename to spring-graphql-web/src/main/java/org/springframework/graphql/servlet/components/GraphQLServletRequestBody.java diff --git a/spring-graphql-webmvc/src/main/java/org/springframework/graphql/servlet/components/package-info.java b/spring-graphql-web/src/main/java/org/springframework/graphql/servlet/components/package-info.java similarity index 100% rename from spring-graphql-webmvc/src/main/java/org/springframework/graphql/servlet/components/package-info.java rename to spring-graphql-web/src/main/java/org/springframework/graphql/servlet/components/package-info.java diff --git a/spring-graphql-webflux/build.gradle b/spring-graphql-webflux/build.gradle deleted file mode 100644 index 17d7668d..00000000 --- a/spring-graphql-webflux/build.gradle +++ /dev/null @@ -1,10 +0,0 @@ -description = "GraphQL Java Spring WebFlux integration" - -dependencies { - api 'com.graphql-java:graphql-java' - - implementation project(':spring-graphql-common') - implementation 'org.springframework:spring-context' - implementation 'org.springframework:spring-webflux' - implementation 'com.fasterxml.jackson.core:jackson-databind' -} diff --git a/spring-graphql-webmvc/build.gradle b/spring-graphql-webmvc/build.gradle deleted file mode 100644 index 1873a823..00000000 --- a/spring-graphql-webmvc/build.gradle +++ /dev/null @@ -1,10 +0,0 @@ -description = "GraphQL Java Spring MVC integration" - -dependencies { - api 'com.graphql-java:graphql-java' - - implementation project(':spring-graphql-common') - implementation 'org.springframework:spring-webmvc' - implementation 'com.fasterxml.jackson.core:jackson-databind' - implementation 'javax.servlet:javax.servlet-api' -}