使用hibernate时,在save方法时,报了:org.hibernate.validator.constraints.NotBlank' validating type 'java.lang.Integer,因为@NotBlank是针对String的   . 解决方法是将实体类的注解换成     @NotNull,就行了, 替换前 替换后…
javax.validation.UnexpectedTypeException: HV000030: No validator could be found for constraint 'javax.validation.constraints.Pattern' validating type 'java.lang.Integer'. Check configuration for 'sortType' at org.hibernate.validator.internal.engine.c…
使用hibernate validator出现上面的错误, 需要注意: @NotNull 和 @NotEmpty  和@NotBlank 区别 @NotEmpty 用在集合类上面@NotBlank 用在String上面@NotNull    用在基本类型上 如果在基本类型上面用NotEmpty或者NotBlank 会出现上面的错 来自为知笔记(Wiz)…
开始是 javax.validation.UnexpectedTypeException: No validator could be found for type: java.lang.Integer, 不能理解为什么,后面想到自己之前代码是好好的,修改了bean 之后才出现这个问题的. 具体来说: @NotEmpty private int cnt; 我加上了这个NotEmpty 后出现的, 于是,去掉吧.结果又出现了其他错误: javax.validation.UnexpectedType…
题记:以前记录过一些自己遇到的BUG,这个行为,让我一看报错的提示信息就能定位到问题的所在,后来记得比较多了,好多是重复性的再加上比较忙就没有详细的记录了,今天的工作量比较小,就顺便记录一下,以便以后更快的解决此类问题. BUG的报错信息如下所示: org.springframework.dao.InvalidDataAccessApiUsageException: Parameter value [41] did not match expected type [java.lang.Integ…
今天在使用Spring Template的时候遇到了这个异常: no suitable HttpMessageConverter found for request type [java.lang.Integer] Google了一下然后在stackoverflow上面找到了解决方案: I have a method in Spring rest service. @RequestMapping(value = "test/process", method = RequestMetho…
controller层返回值类型为Integer,运行报错: Unknown return value type: java.lang.Integer 解决办法:在此方法上写上注解 @ResponseBody . @responseBody注解的使用 1. @responseBody注解的作用是将controller的方法返回的对象通过适当的转换器转换为指定的格式之后,写入到response对象的body区,通常用来返回JSON数据或者是XML 数据,需要注意的呢,在使用此注解之后不会再走试图处…
controller层返回值类型为Integer,然而报 Unknown return value type: java.lang.Integer 这个错误,500错误 解决办法:在此方法上写上注解@ResponseBody…
在写接口时,一般去查找在类的Integer属性上加了不属于整型的校验,比如@NotEmpty,@Length等 @JSONField(name = "deviceNum") @NotNull(message = "设备数量必填") @Length(max = 200, message = "请不要填写超过200个字符") private Integer deviceNum; 去掉@Length(max = 200, message = "…
GET方式,参数必须放在URL后面,http://xxx/list?name={name}&age={age} package com.chelizi.xiruo.xframework.util; import net.sf.json.JSONObject; import org.springframework.http.*; import org.springframework.http.client.SimpleClientHttpRequestFactory; import org.spr…