java 注解Long转String、LocalDateTime转String 指定时间格式

1、LocalDateTime转String (选其一注解)

@JsonFormat(shape=JsonFormat.Shape.STRING, pattern="yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDateTime startTime;

2、Long转String

@JsonSerialize(using = ToStringSerializer.class)
private Long id;

3、BigDecimal 转String

@JsonFormat(shape = JsonFormat.Shape.STRING)

private BigDecimal applyPrice;

你可能感兴趣的:(java)