网上查了一大堆, 都写得跟个啥似的… 用Gson作为HttpMessageConverter很简单啊
application.yml中添加:
spring:
http:
converters:
preferred-json-mapper: gson
或者application.properties:
spring.http.converters.preferred-json-mapper=gson
这就搞定了.
但是, 还没完, 改完这个会出现:
Gson和Swagger不兼容问题
简单, 加个类就可以啦!
import com.google.gson.*
import org.springframework.beans.factory.annotation.Value
import org.springframework.boot