教学视频让我们引入这段依赖

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

然后它就一直标红,然后我各种百度,还是找不到解决方案
新建一个module试试

在这里插入图片描述
在这里插入图片描述

这样,项目中就直接完成了该依赖的引入

问题总结:

1、个人觉得这是版本问题,教学视频用的是1.5,而现在已经是2.3了

2、若jar包下载失败,则到找到maven的jar包下载目录,将其删除,重新下载。默认
目录c盘下用户.m2\repository\org\springframework

3、链接: thymeleaf版本问题.

4、controller层
一定要用Controller 注解;而不是RestController 因为它是rest接口(json格式) 是解析不到html

5、HTML文件要放在resource\templates文件夹中

链接: pom.xml文件总是报错,一直提示Dependency 'xxxx‘ not found.亲测有效

GitHub 加速计划 / sp / spring-boot
37
6
下载
spring-projects/spring-boot: 是一个用于简化Spring应用开发的框架。适合用于需要快速开发企业级Java应用的项目。特点是可以提供自动配置、独立运行和内置的Tomcat服务器,简化Spring应用的构建和部署。
最近提交(Master分支:16 天前 )
1cd14c96 Prior to this commit, Spring Boot would use Framework's `Jackson2ObjectMapperBuilder` to configure the `ObjectMapper` instance. This builder would configure the `ProblemDetail` mixin automatically. With the introduction of Jackson 3.x support, Spring Framework removed its builder in favor of the native Jackson builder. As a result, the mixin is not registered with the `JsonMapper` aymore. This commit ensures that the mixin is registered if the `ProblemDetail` class is present in the classpath. Closes gh-47298 18 小时前
51b606e9 - 19 小时前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐