最近学习thymeleaf,调试的时候报错 template might not exist or might not be accessible by any of the configured,试了网上好多方法都无济于事。
后来发现是我pom.xml配置问题。
首先发现target里没有template文件夹,你也可以看看你的,如果有的话,那就不是和我一样的问题。
于是在pom.xml里加了一条
<include>**/*.html</include>
然后target里生成了templates文件夹,然后就成功访问了。
当然,为了方便,可以这样设置
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.*</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.*</include>
</includes>
</resource>
</resources>