Estou com problemas seguindo o tutorial.
TopicosController.java
@RequestMapping("/topicos")
public List<TopicoDto> lista() {
Topico topico = new Topico("Dúvida", "Dúvida com SpringBoot", new Curso("Spring", "Programação"));
return TopicoDto.converter(Arrays.asList(topico, topico, topico));
}
TopicoDto.java
public void topicoDto(Topico topico) {
this.id = topico.getId();
this.titulo = topico.getTitulo();
this.mensagem = topico.getMensagem();
this.dataCriacao = topico.getDataCriacao();
}
// getters
{...}
public static List<TopicoDto> converter(List<Topico> topicos) {
return topicos.stream().map(TopicoDto::new).collect(Collectors.toList());
}
Podem me explicar do que se trata esse erro:
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Wed Jul 07 16:37:11 GMT-03:00 2021
There was an unexpected error (type=Internal Server Error, status=500).
Unresolved compilation problems: The method map(Function<? super Topico,? extends R>) in the type Stream<Topico> is not applicable for the arguments (Topico::new) The type Topico does not define Topico(Topico) that is applicable here
java.lang.Error: Unresolved compilation problems:
The method map(Function<? super Topico,? extends R>) in the type Stream<Topico> is not applicable for the arguments (Topico::new)
The type Topico does not define Topico(Topico) that is applicable here