Configure gson in Spring using GsonHttpMessageConverter [deprecated]

WebMvcConfigurerAdapter is deprecated. As of Spring 5.0 do this, so this is not working any more and we should use Force Spring Boot to use Gson instead of Jackson

Excluding jackson from classpath

@EnableAutoConfiguration(exclude = { JacksonAutoConfiguration.class })
public class Application {

    public static void main(String[] args) {, args);

Using java config

public class Application extends WebMvcConfigurerAdapter {

    public void configureMessageConverters(List<HttpMessageConverter < ? >> converters) {
        GsonHttpMessageConverter gsonHttpMessageConverter = new GsonHttpMessageConverter();