title: Spring Web streaming endpoint (using ResponseBodyEmitter) configured with GSON gets closed after one response object is written
body: <p>I have an endpoint that's leveraging Spring's <code>ResponseBodyEmitter</code> feature to stream a response back to the client.  Let's suppose the endpoint signature looks like this:</p>
  
  <pre><code>@RequestMapping(method = RequestMethod.GET)
  public ResponseBodyEmitter streamQuotes(@RequestParam("symbols") String symbolList);
  </code></pre>
  
  <p>The application running this is a Spring boot web application.  By default, the application uses Jackson to serialize response objects, which get written to the response output stream as chunks of JSON.</p>
  
  <p>This all works fine.  I'm able to call this endpoint and the response is a stream of data coming back over a period of time.  This is the behavior that I expect.</p>
  
  <p>The problem I'm having is when I switch out Jackson and replace it with GSON, as follows:</p>
  
  <pre><code>@Bean
  public GsonHttpMessageConverter getGsonHttpMessageConverter() {
      Gson gson = new GsonBuilder()
              .create();
  
      GsonHttpMessageConverter gsonConverter = new GsonHttpMessageConverter();
      gsonConverter.setGson(gson);
      return gsonConverter;
  }
  </code></pre>
  
  <p>If I make a request to the same endpoint with GSON as the message converter, I receive only the first data object written to the stream.  At this point, the connection is closed and the server returns 200/OK.  It seems like something in the GSON message converter is closing the output stream.</p>
  
  <p>What do I need to change in my Spring/GSON configuration to make this work in the same manner that Jackson does (stream is left open and data is written to it over time)?</p>