Warm tip: This article is reproduced from stackoverflow.com, please click
spring spring-boot spring-mvc Thymeleaf

Cannot resolve MVC "view" thymeleaf

发布于 2020-03-30 21:14:46

I got a simple HomeController.class:

package com.example.tacos;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

@Controller
public class HomeController {

    @GetMapping("/")
    public String home() {
        return "home";
    }
}

Also I got a template called home.html

<!DOCTYPE HTML>
    <head>
    <title>Getting Started: Serving Web Content</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    </head>
    <body>
        <p>Hey</p>
    </body>
</html>

Anyway I'm getting 404 in the browser and IDE's telling me Cannot resolve MVC "view" as you can see on the screen

Folder Structure: Folder Structure

Browser: Browser

Questioner
Vadim Sheremetov
Viewed
532
gumira 2020-03-07 11:42

Hi I had the same issue and I fixed it by delete the version of Thymeleaf so the pom file will be like :

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