Error resolving template [index], template might not exist or might not be accessible by any of the configured Template Resolvers

1.thymeleaf依赖

    <!-- thymeleaf       -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>

2.注意静态资源的加载(templates)

      <resource>
                <directory>src/main/resources</directory>
                <includes>
                    <include>**/*.xml</include>
                    <include>**/*.properties</include>
                    <include>**/*.yml</include>
                    <include>**/*</include>
                </includes>
                <filtering>true</filtering>
            </resource>

3.配置

thymeleaf:
    cache: false
    prefix: classpath:/templates   1.本是默认的地址一般不要加 第一次问题去掉就成功了     2.如果需要加 最后面不要加/
    suffix: .html
    check-template-location: true
    check-template: true

 

posted @ 2023-01-10 23:45  西东怪  阅读(399)  评论(1编辑  收藏  举报
返回顶端