請(qǐng)教一下,為啥return CommonReturnType.create(itemVO)就會(huì)報(bào)下面這個(gè)錯(cuò)誤?
WARN 2332 --- [nio-8090-exec-1] .m.m.a.ExceptionHandlerExceptionResolver :
Resolved [org.springframework.http.converter.HttpMessageConversionException: Type definition error: [simple type, class com.miaoshaproject.controller.viewobject.ItemVO]; nested exception is com.fasterxml.jackson.databind.exc.InvalidDefinitionException: No serializer found for class com.miaoshaproject.controller.viewobject.ItemVO and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain: com.miaoshaproject.response.CommonReturnType["data"])]
我調(diào)試了一下,發(fā)現(xiàn)
BeanUtils.copyProperties(itemModel,?itemVO);
根本就沒有把屬性值copy給itemVO,但是我的itemModel和itemVO的字段完全一致,包括字段的類型。這是為什么
2020-06-07
我也這個(gè)錯(cuò)誤,哭了
2020-04-22
我也是這個(gè)錯(cuò)誤555555
2019-09-11
我也是你這個(gè)錯(cuò)誤哈哈
2019-05-31
根據(jù)你的提示,我也給ItemVO里要加getset方法。但是,程序還是有點(diǎn)兒問題,http://localhost:8090/item/get?id=1
提示報(bào)錯(cuò)(數(shù)據(jù)庫里存在id=1的商品),
但是,http://localhost:8090/item/get?id=3?的時(shí)候,卻是:
可是,數(shù)據(jù)庫里明明沒有id=3的商品啊。。。。。
還在找原因中.....
2019-01-23
翻譯過來就是——spring報(bào)錯(cuò)說:兄弟,我沒辦法給你的ItemVO序列化啊,我不能get和set你的ItemVO里的私有變量。。。。
?
2019-01-23
3點(diǎn)40看到你這條。。。關(guān)燈睡覺了。
2019-01-15
還是自己來終結(jié)吧。經(jīng)過跟蹤源碼,發(fā)現(xiàn)是忘了給itemVO的屬性賦予get/set方法。ps:建議各位不是夜貓子的還是不要半夜里寫代碼,是真容易出bug。。。