@Bean
public GsonBuilder gsonBuilder(List <GsonBuilderCustomizer> customizers) {
GsonBuilder builder = new GsonBuilder();
customizers.forEach((c) -> c.customize(builder));
builder
.serializeNulls()
.excludeFieldsWithoutExposeAnnotation()
.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES);
}
@AllArgsConstructor
@Getter
@Setter
@NoArgsConstructor
public class ModelStepInfo {
public boolean isSuccessed;
public String description;
public LocalDateTime startTime;
public LocalDateTime endTime;
}
gson.toJson(new ModelStepInfo(false, "dasdsada", LocalDateTime.now(), LocalDateTime.now()))
打印:{} 版本:2.10.1 为什么它出来是空的? 任何解决方案? 我不知道怎么了。