天天看點

Error resolving template [xxx], template might not exist or might not be exist

Springboot+thymeleaf+mybatis 抛Error resolving template [xxx], template might not exist的異常

原因是我們在pom.xml增加的以下内容導緻的,以下内容中src/main/resources這項中沒有把你的html檔案包括進去,懶一點的做法(<include>**/*.*</include>),

<resources>
    <resource>
        <targetPath>${project.build.directory}/classes</targetPath>
        <directory>src/main/resources</directory>
        <filtering>true</filtering>
        <includes>
            <include>**/*.yml</include>
            <include>**/*.xml</include>
        </includes>
    </resource>
    <resource>
        <targetPath>${project.build.directory}/classes</targetPath>
        <directory>src/main/java</directory>
        <includes>
            <include>**/*.*</include>
            <include>**/*.xml</include>
        </includes>
    </resource>
</resources>      
還有增加整段内容的目的是為了解決另一個問題,掃描不到mybatis的mapper.xml檔案(在調用Mapper層方法時報錯:Invalid bound statement (not found)),增加在最後面的<build></build>之間      

轉載于:https://www.cnblogs.com/freestudy/p/10348856.html