增加bigDecimalModule
This commit is contained in:
@@ -5,6 +5,8 @@ import com.fasterxml.jackson.core.JsonParser.Feature;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
public class ObjectMapperFactory {
|
||||
private static final ObjectMapper objectMapper = new ObjectMapper();
|
||||
@@ -18,6 +20,9 @@ public class ObjectMapperFactory {
|
||||
|
||||
static {
|
||||
objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES).disable(SerializationFeature.FAIL_ON_EMPTY_BEANS).disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS).configure(Feature.ALLOW_SINGLE_QUOTES, true);
|
||||
SimpleModule bigDecimalModule = new SimpleModule();
|
||||
bigDecimalModule.addSerializer(BigDecimal.class, new ToStringSerializer());
|
||||
objectMapper.registerModule(bigDecimalModule);
|
||||
objectMapper.setDateFormat(new MyDateFormat());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user