From 87eb576068da66fd7c316863b0fc954a2f72c40d Mon Sep 17 00:00:00 2001 From: Alexey Zhokhov Date: Thu, 23 Apr 2020 19:35:30 +0800 Subject: [PATCH 1/3] Added ability to auto-detect and enable GraphQLResponseCache if implementation is provided. --- build.gradle | 2 +- .../tools/boot/GraphQLJavaToolsAutoConfiguration.java | 5 ++--- .../spring/web/boot/GraphQLWebAutoConfiguration.java | 5 +++++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index d03d9759..39c0d47d 100644 --- a/build.gradle +++ b/build.gradle @@ -36,7 +36,7 @@ subprojects { group "$PROJECT_GROUP" repositories { -// mavenLocal() + mavenLocal() mavenCentral() jcenter() maven { url "https://dl.bintray.com/graphql-java-kickstart/releases" } diff --git a/graphql-kickstart-spring-boot-autoconfigure-tools/src/main/java/graphql/kickstart/tools/boot/GraphQLJavaToolsAutoConfiguration.java b/graphql-kickstart-spring-boot-autoconfigure-tools/src/main/java/graphql/kickstart/tools/boot/GraphQLJavaToolsAutoConfiguration.java index b6791462..29c475d6 100644 --- a/graphql-kickstart-spring-boot-autoconfigure-tools/src/main/java/graphql/kickstart/tools/boot/GraphQLJavaToolsAutoConfiguration.java +++ b/graphql-kickstart-spring-boot-autoconfigure-tools/src/main/java/graphql/kickstart/tools/boot/GraphQLJavaToolsAutoConfiguration.java @@ -10,7 +10,6 @@ import graphql.kickstart.tools.PerFieldObjectMapperProvider; import graphql.kickstart.tools.SchemaParser; import graphql.kickstart.tools.SchemaParserBuilder; -import graphql.kickstart.tools.SchemaParserDictionary; import graphql.kickstart.tools.SchemaParserOptions; import graphql.kickstart.tools.SchemaParserOptions.GenericWrapper; import graphql.kickstart.tools.TypeDefinitionFactory; @@ -46,7 +45,7 @@ public class GraphQLJavaToolsAutoConfiguration { @Autowired(required = false) - private SchemaParserDictionary dictionary; + private SchemaParserBuilder schemaParserBuilder; @Autowired(required = false) private GraphQLScalarType[] scalars; @@ -123,7 +122,7 @@ public SchemaParser schemaParser( SchemaStringProvider schemaStringProvider, SchemaParserOptions.Builder optionsBuilder ) throws IOException { - SchemaParserBuilder builder = dictionary != null ? new SchemaParserBuilder(dictionary) : new SchemaParserBuilder(); + SchemaParserBuilder builder = schemaParserBuilder != null ? schemaParserBuilder : new SchemaParserBuilder(); List schemaStrings = schemaStringProvider.schemaStrings(); schemaStrings.forEach(builder::schemaString); diff --git a/graphql-spring-boot-autoconfigure/src/main/java/graphql/kickstart/spring/web/boot/GraphQLWebAutoConfiguration.java b/graphql-spring-boot-autoconfigure/src/main/java/graphql/kickstart/spring/web/boot/GraphQLWebAutoConfiguration.java index d994a01c..6142509a 100644 --- a/graphql-spring-boot-autoconfigure/src/main/java/graphql/kickstart/spring/web/boot/GraphQLWebAutoConfiguration.java +++ b/graphql-spring-boot-autoconfigure/src/main/java/graphql/kickstart/spring/web/boot/GraphQLWebAutoConfiguration.java @@ -38,6 +38,7 @@ import graphql.kickstart.servlet.AbstractGraphQLHttpServlet; import graphql.kickstart.servlet.GraphQLConfiguration; import graphql.kickstart.servlet.GraphQLHttpServlet; +import graphql.kickstart.servlet.cache.GraphQLResponseCache; import graphql.kickstart.servlet.config.DefaultGraphQLSchemaServletProvider; import graphql.kickstart.servlet.config.GraphQLSchemaServletProvider; import graphql.kickstart.servlet.context.GraphQLServletContextBuilder; @@ -130,6 +131,9 @@ public class GraphQLWebAutoConfiguration { @Autowired(required = false) private BatchInputPreProcessor batchInputPreProcessor; + @Autowired(required = false) + private GraphQLResponseCache graphQLResponseCache; + @PostConstruct void postConstruct() { if (errorHandler != null) { @@ -287,6 +291,7 @@ public GraphQLConfiguration graphQLServletConfiguration(GraphQLInvocationInputFa .with(graphQLServletProperties.getSubscriptionTimeout()) .with(batchInputPreProcessor) .with(graphQLServletProperties.getContextSetting()) + .with(graphQLResponseCache) .build(); } From 62041ff8effe0d283fa658a6c85367a4cbb2fd44 Mon Sep 17 00:00:00 2001 From: Alexey Zhokhov Date: Mon, 25 May 2020 01:02:51 +0800 Subject: [PATCH 2/3] Use GraphQLResponseCacheManager. --- .../spring/web/boot/GraphQLWebAutoConfiguration.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/graphql-spring-boot-autoconfigure/src/main/java/graphql/kickstart/spring/web/boot/GraphQLWebAutoConfiguration.java b/graphql-spring-boot-autoconfigure/src/main/java/graphql/kickstart/spring/web/boot/GraphQLWebAutoConfiguration.java index 0dfc26bf..df0de917 100644 --- a/graphql-spring-boot-autoconfigure/src/main/java/graphql/kickstart/spring/web/boot/GraphQLWebAutoConfiguration.java +++ b/graphql-spring-boot-autoconfigure/src/main/java/graphql/kickstart/spring/web/boot/GraphQLWebAutoConfiguration.java @@ -38,7 +38,7 @@ import graphql.kickstart.servlet.AbstractGraphQLHttpServlet; import graphql.kickstart.servlet.GraphQLConfiguration; import graphql.kickstart.servlet.GraphQLHttpServlet; -import graphql.kickstart.servlet.cache.GraphQLResponseCache; +import graphql.kickstart.servlet.cache.GraphQLResponseCacheManager; import graphql.kickstart.servlet.config.DefaultGraphQLSchemaServletProvider; import graphql.kickstart.servlet.config.GraphQLSchemaServletProvider; import graphql.kickstart.servlet.context.GraphQLServletContextBuilder; @@ -132,7 +132,7 @@ public class GraphQLWebAutoConfiguration { private BatchInputPreProcessor batchInputPreProcessor; @Autowired(required = false) - private GraphQLResponseCache graphQLResponseCache; + private GraphQLResponseCacheManager responseCacheManager; @PostConstruct void postConstruct() { @@ -289,7 +289,7 @@ public GraphQLConfiguration graphQLServletConfiguration(GraphQLInvocationInputFa .with(graphQLServletProperties.getSubscriptionTimeout()) .with(batchInputPreProcessor) .with(graphQLServletProperties.getContextSetting()) - .with(graphQLResponseCache) + .with(responseCacheManager) .build(); } From d64b9ce0820609b910f772f90e8968b4d8c5dcc6 Mon Sep 17 00:00:00 2001 From: Michiel Oliemans Date: Sat, 28 Nov 2020 10:27:52 +0100 Subject: [PATCH 3/3] Update build.gradle Force rebuild to run new checks --- build.gradle | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 39c0d47d..be7670bf 100644 --- a/build.gradle +++ b/build.gradle @@ -4,9 +4,9 @@ * Copyright (c) 2016 oEmbedler Inc. and Contributors * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated - * documentation files (the "Software"), to deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit - * persons to whom the Software is furnished to do so, subject to the following conditions: + * documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + * persons to whom the Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. *