1
resposta

There was an unexpected error (type=Not Found, status=404).

Whitelabel Error Page This application has no explicit mapping for /error, so you are seeing this as a fallback.

Thu Jul 04 12:06:59 BRT 2024 There was an unexpected error (type=Not Found, status=404). No static resource topico. org.springframework.web.servlet.resource.NoResourceFoundException: No static resource topico. at org.springframework.web.servlet.resource.ResourceHttpRequestHandler.handleRequest(ResourceHttpRequestHandler.java:585) at org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter.handle(HttpRequestHandlerAdapter.java:52) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1089) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:979) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1014) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:903) at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:564)


@RestController
@RequestMapping("/topico")

public class topicoController {

    @Autowired
    private topicoRepository topicoRepository;

    @Autowired
    private Topico topico;

    @PostMapping
    @Transactional
    public ResponseEntity novotopico (@RequestBody @Valid novoTopicoDTO dados){

        return ResponseEntity.ok(null);

    }

    @GetMapping
    public String  teste() {
       return "teste";
    }

}
1 resposta

Oi!

A princípio o código está correto. Reinicie o servidor para garantir que as mudanças serão refletidas e verifica também o pacote onde você criou a classe controller, pois ele precisa ser um pacote filho do pacote principal do projeto, onde está localizada a classe main.