Spring boot error called controller "This application has no Explicit Mapping for /error"

Asked

Viewed 5,711 times

0

I have a problem because I’m learning to use the methods GET and POST using the Spring Boot, but only one controller I’m not able to show on the screen. Well I’m using the JSP already configured in the aplication.propertties.

spring.mvc.view.prefix=/WEB-INF/jsp/
spring.mvc.view.suffix=.jsp

The question is that I have 3 tables on Mysql one and the training and the other and courses

@Controller
public class MainControllerCur {
    @Autowired
    AppCursosRepo appRepocur;

    @RequestMapping("/cursos")
    public ModelAndView doHomeCur(){
        ModelAndView mv = new ModelAndView("cursos");
        mv.addObject("listscur",appRepocur.findAll());
        return mv;
    }

}


@Controller
public class MainControllerTr {
    @Autowired
    AppTreinamentoRepo appRepo;

    @RequestMapping("/treinamento")
    public ModelAndView doHome(){
        ModelAndView mv = new ModelAndView("index");
        return mv;
    }

But this here is the employee and the only one that does not generate vision of the server when I call the JSP.

@Controller
public class MainControllerFunc {
    @Autowired
    AppFuncionarioRepo appRepofunc;

    @RequestMapping("/funcionario")
    public ModelAndView doHomeFunc(){
        ModelAndView mv = new ModelAndView("funcionario");
        mv.addObject("listsfunc",appRepofunc.findAll());
        return mv;
    }
}

What’s strange and what’s exactly like the other two just changes the call /funcionario build normal without any error no error log appears in the console.

The mistake is always this

Whitelabel Error Page

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

Sat Oct 14 01:14:19 BRT 2017
There was an unexpected error (type=Not Found, status=404).
/WEB-INF/jsp/funcionario.jsp

If anyone can give me an explanation I’d be grateful.

  • Review the names you’re using in the view and controller. Make sure it’s working and not working?

  • pay attention to the structure of the folders, in case your Application cannot stay on the same level as the other files. I resolved my error from this link https://www.yawintutor.com/application-has-no-explicit-mapping-for-error-whitelabel-error-page-with-status-404/

1 answer

0

It is necessary to add the dependency:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.