title: Controller in DGS Netflix Graphql
body: <p>We are developing a project Using Spring boot with DGS Netflix  graphql. We are created all the schemas and datafethers which is working absolutely fine with a default endpoint &quot;/graphql&quot;. we would like to expose this app with custom endpoing so we are trying to add a controller with a custom endpoint as below. But When i run the application and send a query, my data fetcher is called twice . first time called from controller and second time i believe from framework it self. Anybody has any thoughts on this why its being called twice and how to avoid it? You help is highly appreciated. Please see the below Datafetcher and Controller.</p>
  <pre><code>Controller:
  
  @RestController
  @RequestMapping(&quot;/sample-information/model&quot;)
  @Slf4j
  public class CustomController {
      
      @Autowired
      DgsQueryExecutor dgsQueryExecutor;
  
      
      @PostMapping(consumes = {MediaType.APPLICATION_JSON_VALUE, &quot;application/graphql&quot;})
      public Mono&lt;ResponseEntity&lt;Object&gt;&gt; getDetails(@RequestBody String query,
              @RequestHeader HttpHeaders headers
              ) {
          GraphQLQueryInput inputs = null;
          try {
              inputs = ObjectMapperHelper.objectMapper.readValue(query, GraphQLQueryInput.class);
          } catch (Exception e) {
              log.error(&quot;TraceId: {} - Application Error: Error message: Error converting query to GraphQLQueryInput: {} &quot;+ query);
              
          }
          
          if(inputs.getVariables() == null) {
              inputs.setVariables(new HashMap&lt;&gt;());
          }
          
          if(inputs.getOperationName() == null) {
              inputs.setOperationName(&quot;&quot;);
          }
          
          final String que = inputs.getQuery();
          final Map&lt;String, Object&gt; var = inputs.getVariables();
          final String opn = inputs.getOperationName();
          
          ExecutionInput.Builder executionInput = ExecutionInput.newExecutionInput()
                  .query(inputs.getQuery())
                  .operationName(inputs.getOperationName())
                  .variables(inputs.getVariables());
          
         return Mono.fromCallable(()-&gt; {
              return dgsQueryExecutor.execute(que, var, opn);
          }).subscribeOn(Schedulers.elastic()).map(result -&gt; {
              return new ResponseEntity&lt;&gt;(result, HttpStatus.OK); 
          }); 
      }
  
  }
  
  Datafetcher:
  
  @DgsComponent
  @Slf4j
  public class SampleDataFetcher {
      @Autowired
      SampleBuilder sampleBuilder;
      
      @DgsData(parentType = DgsConstants.QUERY_TYPE, field = DgsConstants.QUERY.SampleField)
      public CompletableFuture&lt;StoreDirectoryByStateResponse&gt; getStoreDirectoryByState(@InputArgument String state, DataFetchingEnvironment dfe) throws BadRequestException {
  
          Mono&lt;StoreDirectoryByStateResponse&gt; storeDirectoryResponse = null;
          try {
              sampleResponse = sampleBuilder.buildResponse(modelGraphQLContext);
          } catch (BaseException e) {
  
          }
          return sampleResponse.map(response -&gt; {
              return response;
          }).toFuture();
          
      }
  }
  </code></pre>