springboot返回json

1、springboot默认基础json转换器为Jackson;

2、直接返回对象就是json了;

如果需要使用别的json转换器如:fastjson

1、引入fastjson包

2、AppAplication继承WebMvcConfigurerAdapter重写方法configuerMessageConverters方法

在里面添加:FastJsonHttpMessageConverter

猜你喜欢

转载自www.cnblogs.com/hy87/p/9059870.html
今日推荐