|
19 | 19 |
|
20 | 20 | package com.oembedler.moon.graphql.boot; |
21 | 21 |
|
22 | | -import com.coxautodev.graphql.tools.PerFieldObjectMapperProvider; |
23 | 22 | import com.fasterxml.jackson.databind.InjectableValues; |
24 | 23 | import com.fasterxml.jackson.databind.ObjectMapper; |
25 | 24 | import graphql.execution.AsyncExecutionStrategy; |
|
29 | 28 | import graphql.execution.instrumentation.Instrumentation; |
30 | 29 | import graphql.execution.preparsed.PreparsedDocumentProvider; |
31 | 30 | import graphql.schema.GraphQLSchema; |
32 | | -import graphql.servlet.AbstractGraphQLHttpServlet; |
33 | | -import graphql.servlet.DefaultExecutionStrategyProvider; |
34 | | -import graphql.servlet.DefaultGraphQLSchemaProvider; |
35 | | -import graphql.servlet.ExecutionStrategyProvider; |
36 | | -import graphql.servlet.GraphQLContextBuilder; |
37 | | -import graphql.servlet.GraphQLErrorHandler; |
38 | | -import graphql.servlet.GraphQLInvocationInputFactory; |
39 | | -import graphql.servlet.GraphQLObjectMapper; |
40 | | -import graphql.servlet.GraphQLQueryInvoker; |
41 | | -import graphql.servlet.GraphQLRootObjectBuilder; |
42 | | -import graphql.servlet.GraphQLSchemaProvider; |
43 | | -import graphql.servlet.GraphQLServletListener; |
44 | | -import graphql.servlet.ObjectMapperConfigurer; |
45 | | -import graphql.servlet.ObjectMapperProvider; |
46 | | -import graphql.servlet.SimpleGraphQLHttpServlet; |
| 31 | +import graphql.servlet.*; |
47 | 32 | import org.springframework.beans.factory.annotation.Autowired; |
48 | 33 | import org.springframework.boot.autoconfigure.AutoConfigureAfter; |
49 | | -import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; |
50 | | -import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; |
51 | | -import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; |
52 | | -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
53 | | -import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; |
| 34 | +import org.springframework.boot.autoconfigure.condition.*; |
54 | 35 | import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration; |
55 | 36 | import org.springframework.boot.context.properties.EnableConfigurationProperties; |
56 | 37 | import org.springframework.boot.web.servlet.ServletRegistrationBean; |
@@ -205,15 +186,15 @@ public GraphQLQueryInvoker queryInvoker(ExecutionStrategyProvider executionStrat |
205 | 186 |
|
206 | 187 | @Bean |
207 | 188 | @ConditionalOnMissingBean |
208 | | - public GraphQLObjectMapper graphQLObjectMapper(Optional<ObjectMapperProvider> objectMapperProvider) { |
| 189 | + public GraphQLObjectMapper graphQLObjectMapper(ObjectMapperProvider objectMapperProvider) { |
209 | 190 | GraphQLObjectMapper.Builder builder = newBuilder(); |
210 | 191 |
|
211 | 192 | if (errorHandler != null) { |
212 | 193 | builder.withGraphQLErrorHandler(errorHandler); |
213 | 194 | } |
214 | 195 |
|
215 | | - if (objectMapperProvider.isPresent()){ |
216 | | - builder.withObjectMapperProvider(objectMapperProvider.get()); |
| 196 | + if (objectMapperProvider != null){ |
| 197 | + builder.withObjectMapperProvider(objectMapperProvider); |
217 | 198 | } else if (objectMapperConfigurer != null) { |
218 | 199 | builder.withObjectMapperConfigurer(objectMapperConfigurer); |
219 | 200 | } |
@@ -256,9 +237,4 @@ private MultipartConfigElement multipartConfigElement() { |
256 | 237 | return Optional.ofNullable(multipartConfigElement).orElse(new MultipartConfigElement("")); |
257 | 238 | } |
258 | 239 |
|
259 | | - @Bean |
260 | | - @ConditionalOnMissingBean |
261 | | - public ObjectMapper objectMapper() { |
262 | | - return new ObjectMapper(); |
263 | | - } |
264 | 240 | } |
0 commit comments