package com.aemreunal.config;

/*
 **************************
 * Copyright (c) 2014     *
 *                        *
 * This code belongs to:  *
 *                        *
 * Ahmet Emre Ünal        *
 * S001974                *
 *                        *
 * aemreunal@gmail.com    *
 * emre.unal@ozu.edu.tr   *
 *                        *
 * aemreunal.com          *
 **************************
 */

import java.util.List;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.ByteArrayHttpMessageConverter;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.hibernate4.Hibernate4Module;

/*
 * http://www.petrikainulainen.net/programming/spring-framework/unit-testing-of-spring-mvc-controllers-configuration/
 */

@Configuration
@EnableWebMvc
@ComponentScan(GlobalSettings.BASE_PACKAGE_NAME)
public class MVCConfig extends WebMvcConfigurerAdapter {
    public MappingJackson2HttpMessageConverter jacksonMessageConverter() {
        MappingJackson2HttpMessageConverter messageConverter = new MappingJackson2HttpMessageConverter();
        ObjectMapper mapper = new ObjectMapper();
        //Registering Hibernate4Module to support lazy objects
        mapper.registerModule(new Hibernate4Module());
        messageConverter.setObjectMapper(mapper);
        return messageConverter;
    }

    public ByteArrayHttpMessageConverter byteArrayHttpMessageConverter() {
        return new ByteArrayHttpMessageConverter();
    }

    @Override
    public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
        // Add our custom-configured HttpMessageConverters
        converters.add(jacksonMessageConverter());
        converters.add(byteArrayHttpMessageConverter());
        super.configureMessageConverters(converters);
    }
}

@@ -419,16 +419,131 @@
 l.List;%0A
+import org.springframework.beans.factory.annotation.Autowired;%0Aimport org.springframework.context.annotation.Bean;%0A
 import o
@@ -591,24 +591,24 @@
 ponentScan;%0A
-
 import org.s
@@ -1411,16 +1411,202 @@
 apter %7B%0A
+    @Autowired%0A    public MappingJackson2HttpMessageConverter jacksonMessageConverter;%0A%0A    @Autowired%0A    public ByteArrayHttpMessageConverter byteArrayHttpMessageConverter;%0A%0A    @Bean%0A
     publ
@@ -2032,24 +2032,34 @@
 ter;%0A    %7D%0A%0A
+    @Bean%0A
     public B
@@ -2378,34 +2378,32 @@
 MessageConverter
-()
 );%0A        conve
@@ -2441,18 +2441,16 @@
 onverter
-()
 );%0A     

Make message converters beans