Spring Boot 项目运行时报错

报错如下:

Error starting ApplicationContext. To display the conditions report re-run your application with ‘debug’ enabled.

一行的大概意思是:

启动ApplicationContext时出错。要显示条件报告,请在启用“调试”的情况下重新运行您的应用程序。

== 主要看下面的错误 ==

Description:

Failed to bind properties under ‘spring.thymeleaf.servlet’ to org.springframework.boot.autoconfigure.thymeleaf.ThymeleafProperties$Servlet:

Reason: No converter found capable of converting from type [java.lang.String] to type [org.springframework.boot.autoconfigure.thymeleaf.ThymeleafProperties$Servlet]

经过多方面的搜索查找找到的方法

①、配置的的application.yml里面项出错了,注意空格

server:

port: 8080

spring:

thymeleaf:

prefix: classpath:/templates/ #模版路径

suffix: .html #模版后缀

servlet:

content-type:text/html #设置 Content-type

encoding: UTF-8 #编码方式

mode: HTML5 #校验 H5格式

cache: false #关闭缓存,在开发过程中可以立即看到页面修改的结果

.yml文件中的content-type:text/html冒号中间没有用空格导致出错,颜色也不对。

②、application.properties文件里面项出错了

#连接数据库 8 #serverTimezone=GMT%2B8:

spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver

spring.datasource.url=jdbc:mysql://localhost:3306/mybatis_plus?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8

spring.datasource.username=root

spring.datasource.password=123456

每一项的后面是使用**=**连接

下次遇到不要在无脑找半天错了

好文链接

评论可见,请评论后查看内容,谢谢!!!
 您阅读本篇文章共花了: