我想在转换spring data interface objections
时使用gson
和HttpConverter
,可是idea中报了这个错误:
org.springframework.http.converter.HttpMessageNotWritableException: Could not write JSON: Attempted to serialize java.lang.Class: com.manager.projections.StaffProjection. Forgot to register a type adapter?; nested exception is java.lang.UnsupportedOperationException: Attempted to serialize java.lang.Class: com.manager.projections.StaffProjection. Forgot to register a type adapter?
请问:
1)这个错误引发的具体原因
2)能这样使用gson
吗?如果不能的话,如何转换会比较合理?