解析模板時(shí)出錯(cuò),模板可能不存在或任何已配置的模板解析程序都無法訪問該模板

我有以下控制器:

@Controller
public class ConfigController {

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

然而,我在前往/路線時(shí)收到以下錯(cuò)誤:

There was an unexpected error (type=Internal Server Error, status=500).
Error resolving template [config], template might not exist or might not be accessible by any of the configured Template Resolvers
org.thymeleaf.exceptions.TemplateInputException: Error resolving template [config], template might not exist or might not be accessible by any of the configured Template Resolvers

我在resources/templates中有一個(gè)config.html文件:

My pom.xml file: https://pastebin.com/yqYYuXWh

我做錯(cuò)了什么?

我已經(jīng)嘗試在控制器函數(shù)的返回中添加一個(gè).html,但它仍然不起作用。


在刪除spring-web依賴項(xiàng)(我已經(jīng)有了spring-boot-starter-web)之后,我現(xiàn)在在啟動(dòng)spring時(shí)出現(xiàn)以下錯(cuò)誤:

Cannot find template location: classpath:/templates/ (please add some templates or check your Thymeleaf configuration)

? 最佳回答:

問題在您的pom.xml文件中。

將此塊添加到build

<resources>
    <resource>
        <directory>src/main/resources</directory>
        <filtering>true</filtering>
        <includes>
            <include>application.properties</include>
        </includes>
    </resource>
</resources>

您已經(jīng)重寫了spring-boot-starter-parent自己的resources塊,并使其包含application.properties而沒有其他內(nèi)容。從pom.xml中刪除它并刪除目標(biāo)目錄。

主站蜘蛛池模板: 在线观看国产一区二区三区| 精品国产亚洲一区二区在线观看| 国产精品无码一区二区三级 | 亚洲日本一区二区| 无码人妻AⅤ一区二区三区水密桃| 中文字幕日韩欧美一区二区三区| 无码日韩精品一区二区免费| 四虎精品亚洲一区二区三区| 中文日韩字幕一区在线观看| 97久久精品无码一区二区天美 | 国产在线精品一区二区高清不卡 | 视频在线一区二区| 国内偷窥一区二区三区视频 | 色狠狠色狠狠综合一区| 怡红院一区二区在线观看| 视频一区精品自拍| 精品国产一区二区麻豆| 国产免费无码一区二区| 国产精品熟女视频一区二区| 亚洲AV无码一区二区二三区入口| 亚洲欧洲专线一区| 日韩一区精品视频一区二区| 日本v片免费一区二区三区 | 亚洲av福利无码无一区二区| 日本一区二区三区不卡视频中文字幕 | 亚洲日韩精品无码一区二区三区| 亚洲综合无码一区二区痴汉| 久久一区二区三区免费播放| 免费一区二区无码视频在线播放| 3d动漫精品啪啪一区二区中文| 日本一区二区三区高清| 精品一区二区三区无码视频| 亚洲sm另类一区二区三区| 老熟妇仑乱视频一区二区| 亚洲国产精品一区| 亚洲一区二区三区电影| 91大神在线精品视频一区| 色婷婷一区二区三区四区成人网| 亚洲老妈激情一区二区三区| 国产一区二区三区91| 久久精品亚洲一区二区|