Could not find acceptable representation

写了一个 controller 方法。 返回类型是 jsonObject ,或者其他 对象 结果就报错了

Could not find acceptable representation

原因是因为少了  将 对象 转为 json 格式的数据的包。




解决办法

1, 可以引入 缺少的包。

2, 将返回类型 改为 string 类型。 将 对象转为 json 对象,并 返回 json 字符串即可。 并不会对前端的 使用造成什么影响的

猜你喜欢

转载自my.oschina.net/u/2419285/blog/1617801