Spring Boot Whitelabel Error page (type=Not Found, status=404)

前端 未结 5 2283
离开以前
离开以前 2021-02-19 10:31

Good afternoon! I\'m starting spring studies, I\'m following a tutorial the same way, but it returns an error:

Folder structure:

The strange th

5条回答
  •  孤独总比滥情好
    2021-02-19 10:55

    Make sure that your main class is in a root package above other classes.

    When you run a Spring Boot Application, (i.e. a class annotated with @SpringBootApplication), Spring will only scan the classes below your main class package.

    So your declaration goes like this

    package br.com.SpringApp.SpringApp; inside this main class i.e SpringAppApplication

    package br.com.SpringApp.SpringApp.controller; name of your controllers i.e EventoController & indexControllers

    package br.com.SpringApp.SpringApp.model; name of your models i.e Evento

    After This clean your project and re-run spring boot application;

提交回复
热议问题