title: jacksonMessageConverter corrupt mp3 file as octet encode response
body: <p>I have a spring MVC config with the following:</p>
  
  <pre><code>       public class SpringConfiguration extends WebMvcConfigurerAdapter {
          public MappingJackson2HttpMessageConverter jacksonMessageConverter() {
              MappingJackson2HttpMessageConverter messageConverter = new MappingJackson2HttpMessageConverter();
  
              ObjectMapper mapper = new ObjectMapper();
              //Registering Hibernate4Module to support lazy objects
              mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
              mapper.registerModule(new Hibernate4Module());
  
              messageConverter.setObjectMapper(mapper);
              return messageConverter;
          }
      @Override
      public void configureMessageConverters(List&lt;HttpMessageConverter&lt;?&gt;&gt; converters) {
          //Here we add our custom-configured HttpMessageConverter
          converters.add(jacksonMessageConverter());
          super.configureMessageConverters(converters);
          }
        }
  </code></pre>
  
  <p>The previous method used to ignore all lazy relation without adding JsonIgnore in model
  The problem is I have a route to steam mp3 file as an octet response as following</p>
  
  <pre><code>@GetMapping(value = "/audio/{id}")
  public ResponseEntity&lt;byte[]&gt; streamMp3FileToAdmin(@PathVariable Integer id) {
      CorporateCampaign camp = corporateCampaignService.findById(id);
      final HttpHeaders httpHeaders = new HttpHeaders();
      httpHeaders.setContentType(MediaType.APPLICATION_OCTET_STREAM);
      return new ResponseEntity&lt;byte[]&gt;(Utilities.getFileAsBytes(camp.getVoiceUrl()),httpHeaders,HttpStatus.OK);
  }
  </code></pre>
  
  <p>If I remove jackson message converter the steaming works fine but when I add jackson message converter the stream doesn't work any more</p>
  
  <p>I read this question <a href="https://stackoverflow.com/questions/5690228/spring-mvc-how-to-return-image-in-responsebody">Spring MVC: How to return image in @ResponseBody?</a></p>
  
  <p>and a lot but I didn't find a solution yet</p>