赞
踩
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>${gson.version}</version>
</dependency>
4.基本配置 (配置文件)
5.用类实现配置
package com.dog.it.config;
import com.google.gson.GsonBuilder;
import org.springframework.boot.autoconfigure.gson.GsonBuilderCustomizer;
import org.springframework.stereotype.Component;
@Component
public class GsonConfig implements GsonBuilderCustomizer {
@Override
public void customize(GsonBuilder gsonBuilder) {
//设置项
gsonBuilder.setDateFormat("yyyy-MM-dd HH:mm:ss");
gsonBuilder.serializeNulls();
}
}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。