Eu fiz a mesma coisa que mostra na aula. Porem esta me dando o erro abaixo quando entro no /topicos
Whitelabel Error Page This application has no explicit mapping for /error, so you are seeing this as a fallback.
Thu Mar 25 20:21:48 BRT 2021 There was an unexpected error (type=Not Found, status=404).
Segue o meu controller: O meu spring é outra versao pq a que o professor falou nao tinha disponivel no inicializer
package br.com.alura.forum.controller;
import java.util.Arrays; import java.util.List;
import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody;
import br.com.alura.forum.modelo.Curso; import br.com.alura.forum.modelo.Topico;
@Controller public class TopicosController {
@RequestMapping("/topicos")
@ResponseBody
public List<Topico> lista(){
Topico topico = new Topico("Duvida", "Duvida com Spring", new Curso("Spring", "Programação"));
return Arrays.asList(topico, topico, topico);
}
}
O meu POM.XML:
4.0.0 org.springframework.boot spring-boot-starter-parent 2.4.4 br.com.alura forum 0.0.1-SNAPSHOT forum API REST Forum Alura <java.version>1.8</java.version> org.springframework.boot spring-boot-starter-web
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>