0
respostas

Quero que retorne os tópicos do segundo código, mas só retorna o hello world do Controller

Retorna hello world no localhost:8080. Código:

package br.com.alura.forum.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HelloController {

    @RequestMapping("/")
    public String hello() {
        return "hello, world";
    }
}

Mas não retorna esses dados:

import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;
import java.util.List;

@RestController
public class TopicosController {

    @RequestMapping("/topicos")
    public List<TopicoDTO> List() {
        Topico topico = new Topico("Dúvida", "Dúvida com Spring", new Curso("Spring", "Programação"));
        return TopicoDTO.convert(Arrays.asList(topico, topico, topico));

    }
}