Created
December 31, 2016 20:38
-
-
Save m-x-k/10d2b223054ba5d7e6f98a645f6df743 to your computer and use it in GitHub Desktop.
Spring boot Gson converter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.springframework.boot.SpringApplication; | |
import org.springframework.boot.autoconfigure.SpringBootApplication; | |
import org.springframework.web.servlet.config.annotation.EnableWebMvc; | |
@SpringBootApplication | |
@EnableWebMvc | |
public class Application { | |
public static void main(String[] args) { | |
SpringApplication.run(Application.class, args); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.springframework.context.annotation.Configuration; | |
import org.springframework.http.converter.HttpMessageConverter; | |
import org.springframework.http.converter.json.GsonHttpMessageConverter; | |
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; | |
import java.util.List; | |
@Configuration | |
public class AppWebMvcConfiguration extends WebMvcConfigurerAdapter { | |
@Override | |
public void configureMessageConverters(List<HttpMessageConverter< ? >> converters) { | |
GsonHttpMessageConverter gsonHttpMessageConverter = new GsonHttpMessageConverter(); | |
converters.add(gsonHttpMessageConverter); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment