With Computer/Spring Starter Project

[intelliJ] Error: HttpMessageNotReadableException

s:tardust 2020. 2. 7. 22:33
[책] 스프링부트와 AWS로 혼자 구현하는 웹서비스

 

Cannot deserialize instance of `java.lang.Long` out of START_OBJECT token

 

com.zozo.book.springboot.web.PostsApiControllerTest > Posts_�����ȴ� FAILED
    org.springframework.web.client.RestClientException at PostsApiControllerTest.java:84
        Caused by: org.springframework.http.converter.HttpMessageNotReadableException at PostsApiControllerTest.java:84
            Caused by: com.fasterxml.jackson.databind.exc.MismatchedInputException at PostsApiControllerTest.java:84
2020-02-07 21:31:39.078  INFO 8648 --- [       Thread-5] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown initiated...
2020-02-07 21:31:39.090  INFO 8648 --- [       Thread-5] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown completed.
1 test completed, 1 failed
> Task :test FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':test'.

불러오는 중입니다...

 

update TDD중에 만난 오류.............ㅠㅠ너무어렵다 이클립스야 ㅂㄱㅅㅍ


우선

 

PostsApiController에서 mapping을 안해줬네?^^;

@PutMapping("/api/v1/posts/{id}")
public Long update(@PathVariable Long id, @RequestBody PostsUpdateRequestsDto requestDto){
return postsService.update(id, requestDto);
}

@GetMapping("/api/v1/posts/{id}")
public PostsResponseDto findById(@PathVariable Long id){
return postsService.findById(id);
}

 

아, 혹시

Cannot deserialize instance of `java.lang.Long` out of START_OBJECT token 

위 얘기는 매핑에 토큰으로 사용할 id가 없어서 못한다 뭐 그건가? 

 


BUILD SUCCESSFUL in 17s
5 actionable tasks: 4 executed, 1 up-to-date
오후 10:30:04: Tasks execution finished ':cleanTest :test --tests "com.zozo.book.springboot.web.PostsApiControllerTest.Posts_수정된다"'.

 

매번 localhost 안치고, 뷰에서 테스트 값 넣는 것보다 몇 배는 빨라보이는데

처음이라 정말 낯설고,,, 낯설고,,, 얼른 뷰가 보고싶고,, 그르네!

오류잡는 건 다 똑같은데 장비도 바꾸고해서 그른가 아직 어색하다

반응형