其他分享
首页 > 其他分享> > template might not exist or might not be accessible by any of the configured Template Resolvers

template might not exist or might not be accessible by any of the configured Template Resolvers

作者:互联网

org.thymeleaf.exceptions.TemplateInputException: Error resolving template [xx], template might not exist or might not be accessible by any of the configured Template Resolvers

错误原因

模板不存在或者找不到任何已配置的模板解析程序可以解析模板

解决方案

在对应的Controller类的方法中,在src/main/resources/templates目录下检查返回的模板是否存在

返回字符串将Controller类中@Controller注解改为@RestController注解

package com.spring.boot.login.controller;

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

import java.util.List;

@RestController
public class LoginController {


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

删去对应的th:语句

thymeleaf添加到<html>标签中

标签:accessible,Resolvers,Controller,thymeleaf,import,org,might,模板
来源: https://blog.csdn.net/qq_44486439/article/details/115220995