@PostMapping @Transactional public ResponseEntity cadastrar(@RequestBody @Valid TopicoForm form, UriComponentsBuilder uriBuilder) { Topico topico = form.converter(cursoRepository); topicoRepository.save(topico);
URI uri = uriBuilder.path("/topicos/{id}").buildAndExpand(topico.getId()).toUri();
return ResponseEntity.created(uri).body(new TopicoDto(topico));
}