728x90
REST API 테스트를 하던 도중
org.springframework.web.HttpMediaTypeNotAcceptableException: Could not find acceptable representation
이와 같은 에러가 발생했다.
@GetMapping("/post/{id}")
public MZ_BoardResponse getPost(@PathVariable Long id){
return mz_boardService.getBoard(id);
}
컨트롤러에선 아무 문제가 없어보였는데, MZ_BoardResponse 클래스에 문제가 있나 확인해보니, @Data 어노테이션을 깜빡하고 추가해주지 않았다.
@Data 말고 @Getter를 추가해줘도 위의 문제를 해결할 수 있다.
'Spring Boot' 카테고리의 다른 글
[Spring Boot] AWS S3 연결 SDK 에러 (0) | 2023.08.07 |
---|---|
[Spring Boot] AWS S3 버킷 연결 에러 (0) | 2023.08.07 |
[Spring Boot] mysql 데이터베이스 연결하기 (0) | 2023.07.30 |
[Spring Boot] MySQL Access denied for user (0) | 2023.07.06 |
[Spring Boot] Could not find com.mysql:mysql-connector-j 오류 (0) | 2023.05.29 |