我有这个弹簧支架控制器:
@RestController
@RequestMapping("/communications")
class CommunicationController(private val service: CommunicationService) {
@ApiOperation(
produces = APPLICATION_JSON_VALUE,
consumes = APPLICATION_JSON_VALUE
)
@GetMapping(
consumes = [APPLICATION_JSON_VALUE],
produces = [APPLICATION_JSON_VALUE]
)
fun findAll(
criterias: CommunicationCriterias,
page: Pageable
): List<CommunicationDTO> = service.findCommunications(criterias, page)
}
[当我通过swagger-ui
(springfox)接口测试此端点时,出现415: content type invalid
错误。标题中似乎没有设置content-type: application/json
。
缺少什么?
HTTP GET请求中没有任何消耗。我认为您应该从consumes
和@GetMapping
中删除@ApiOperation
。