Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring - Cannot resolve MVC "view" thymeleaf

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

like image 569
Vadim Sheremetov Avatar asked Dec 31 '22 08:12

Vadim Sheremetov


1 Answers

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>
like image 164
gumira Avatar answered Jan 14 '23 08:01

gumira