From 15025754a6f0850d1e3eff23296ace2337186c10 Mon Sep 17 00:00:00 2001 From: mwolff Date: Thu, 14 Oct 2021 10:15:44 +0200 Subject: [PATCH] moving private JacksonObjectMapper into companion object to establish compatibility with CGLIB proxying --- .../netflix/graphql/dgs/mvc/DgsRestSchemaJsonController.kt | 6 ++++-- .../dgs/subscriptions/sse/DgsSSESubscriptionHandler.kt | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/graphql-dgs-spring-webmvc/src/main/kotlin/com/netflix/graphql/dgs/mvc/DgsRestSchemaJsonController.kt b/graphql-dgs-spring-webmvc/src/main/kotlin/com/netflix/graphql/dgs/mvc/DgsRestSchemaJsonController.kt index 18371dbfa..827fa58fb 100644 --- a/graphql-dgs-spring-webmvc/src/main/kotlin/com/netflix/graphql/dgs/mvc/DgsRestSchemaJsonController.kt +++ b/graphql-dgs-spring-webmvc/src/main/kotlin/com/netflix/graphql/dgs/mvc/DgsRestSchemaJsonController.kt @@ -35,8 +35,6 @@ import org.springframework.web.bind.annotation.RestController @RestController open class DgsRestSchemaJsonController(open val schemaProvider: DgsSchemaProvider) { - private val mapper = jacksonObjectMapper() - // The @ConfigurationProperties bean name is - @RequestMapping("#{@'dgs.graphql-com.netflix.graphql.dgs.webmvc.autoconfigure.DgsWebMvcConfigurationProperties'.schemaJson.path}", produces = ["application/json"]) fun schema(): String { @@ -49,4 +47,8 @@ open class DgsRestSchemaJsonController(open val schemaProvider: DgsSchemaProvide return mapper.writeValueAsString(execute.toSpecification()) } + + companion object { + private val mapper = jacksonObjectMapper() + } } diff --git a/graphql-dgs-subscriptions-sse/src/main/kotlin/com/netflix/graphql/dgs/subscriptions/sse/DgsSSESubscriptionHandler.kt b/graphql-dgs-subscriptions-sse/src/main/kotlin/com/netflix/graphql/dgs/subscriptions/sse/DgsSSESubscriptionHandler.kt index 779f60d68..ba51f25ae 100644 --- a/graphql-dgs-subscriptions-sse/src/main/kotlin/com/netflix/graphql/dgs/subscriptions/sse/DgsSSESubscriptionHandler.kt +++ b/graphql-dgs-subscriptions-sse/src/main/kotlin/com/netflix/graphql/dgs/subscriptions/sse/DgsSSESubscriptionHandler.kt @@ -43,7 +43,6 @@ import java.util.* */ @RestController open class DgsSSESubscriptionHandler(open val dgsQueryExecutor: DgsQueryExecutor) { - private val mapper = jacksonObjectMapper() @RequestMapping("/subscriptions", produces = ["text/event-stream"]) fun subscriptionWithId(@RequestParam("query") queryBase64: String): ResponseEntity { @@ -152,6 +151,7 @@ open class DgsSSESubscriptionHandler(open val dgsQueryExecutor: DgsQueryExecutor ) companion object { + private val mapper = jacksonObjectMapper() private val logger: Logger = LoggerFactory.getLogger(DgsSSESubscriptionHandler::class.java) } }