亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

money字段加上@NotNull之后,通過Postman工具添加girl,報For input string: \"Min\


controller

@PostMapping("/addGirl")
public Result addGirl(@Valid Girl girl, BindingResult bindingResult) {
? ?if (bindingResult.hasErrors()) {
? ? ? ?return ResultUtil.fail(new Integer(bindingResult.getFieldError().getCode()), bindingResult.getFieldError().getDefaultMessage());
? ?}
? ?return ResultUtil.success(girlRepository.save(girl));
}


domain

@Entity
public class Girl {

? ?@Id
? ?@GeneratedValue
? ?private Integer id;
? ?private String cupSize;
? ?@Min(value = 18, message = "不能小于18歲")
? ?private Integer age;
? ?@NotNull(message = "金額必傳")
? ?private Double money;

? ?public Double getMoney() {
? ? ? ?return money;
? ?}

? ?public void setMoney(Double money) {
? ? ? ?this.money = money;
? ?}

? ?public Girl() {
? ?}

? ?public Integer getId() {
? ? ? ?return id;
? ?}

? ?public void setId(Integer id) {
? ? ? ?this.id = id;
? ?}

? ?public String getCupSize() {
? ? ? ?return cupSize;
? ?}

? ?public void setCupSize(String cupSize) {
? ? ? ?this.cupSize = cupSize;
? ?}

? ?public Integer getAge() {
? ? ? ?return age;
? ?}

? ?public void setAge(Integer age) {
? ? ? ?this.age = age;
? ?}

? ?@Override
? ?public String toString() {
? ? ? ?return "Girl{" +
? ? ? ? ? ? ? ?"id=" + id +
? ? ? ? ? ? ? ?", cupSize='" + cupSize + '\'' +
? ? ? ? ? ? ? ?", age=" + age +
? ? ? ? ? ? ? ?", money=" + money +
? ? ? ? ? ? ? ?'}';
? ?}
}


以下是postman請求截圖

http://img1.sycdn.imooc.com//5a174dc00001ab3616040570.jpg


為什么報這個錯誤,老鐵幫忙看看

正在回答

3 回答

我也是這個問題? 則呢么請空緩存? 輸入正確的也報錯

0 回復 有任何疑惑可以回復我~

有時候有緩存在里面,導致你的請求沒有發現你修改的內容,很正常,需要過幾秒之后再試試就行了

0 回復 有任何疑惑可以回復我~

后來重新請求了一次又可以了,什么都沒改,發現唯一的區別就是第一次請求的header中多了connection=close,這是為什么?

0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

money字段加上@NotNull之后,通過Postman工具添加girl,報For input string: \"Min\

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號