fastxml.jackson在Spring Boot中解析错误的类

时间:2018-12-16 06:55:16

标签: java spring-boot jackson

我发现fastxml.jackson解析了我项目中的错误类。 我有这个控制器方法:

@PutMapping
public Course updateCourse(@RequestBody CourseDto course) {
    LoggedUser.logIn(authenticationFacade.getAuthentication().getName());
    Course courseEntity = converter.convert(course);
    return courseService.updateCourse(courseEntity);
}

但是当我向API发送PUT请求时,我收到了以下日志:

2018-12-16 13:36:58.339  WARN 9400 --- [nio-8080-exec-4] .m.m.a.ExceptionHandlerExceptionResolver : Resolved [org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Unresolved forward references for: ; nested exception is com.fasterxml.jackson.databind.deser.UnresolvedForwardReference: Unresolved forward references for: 
 at [Source: (PushbackInputStream); line: 93, column: 1]Object id [3] (for `server.crm.entities.Course`) at [Source: (PushbackInputStream); line: 27, column: 24], Object id [3] (for `server.crm.entities.Course`) at [Source: (PushbackInputStream); line: 46, column: 24], Object id [3] (for `server.crm.entities.Course`) at [Source: (PushbackInputStream); line: 65, column: 24], Object id [3] (for `server.crm.entities.Course`) at [Source: (PushbackInputStream); line: 84, column: 24].]

您可以看到它尝试解析server.crm.entities.Course,而不是像@RequestBody之后那样解析CourseDto。

您能帮我解决这个问题吗?

0 个答案:

没有答案