我有BigDecimalSerializer
public class BigDecimalSerializer extends JsonSerializer<BigDecimal> {
@Override
public void serialize(BigDecimal value, JsonGenerator gen, SerializerProvider serializers)
throws IOException {
gen.writeString(value.setScale(6, BigDecimal.ROUND_HALF_UP).toString());
}
}
接着
@JsonSerialize(using = BigDecimalSerializer.class)
private BigDecimal foo;
有什么方法可以代替在每个成员变量中进行注释,而是立即告诉 spring boot 适用于所有项目?