控制台输出:
Resolved [org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'text/plain;charset=UTF-8' not supported]
访问的接口:
@PostMapping("/book")
public ResponseEntity<List<Book>> addBook(@RequestBody Book book){
books.add(book);
return ResponseEntity.ok(books);
}
postman:
解决方式:之前用text,改为json
SpringBoot 默认使用 Json 作为响应报文格式
更多推荐
SpringBoot报错:Content type 'text/plain;charset=UTF-8' not supported
发布评论