报错信息:
java.sql.SQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up.
Caused by: com.mysql.cj.exceptions.CJException: Unknown database '${hm.db.database}'
can not init dataSource
Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Initialization of bean failed; nested exception is java.lang.IllegalStateException: can not init dataSource
解决:
不用怀疑,就是数据库连接配置有问题,使用dbms检查一下数据库连接是否成功,不成功就检查jdbc的连接信息是不是写错了,数据库ip呀,用户名密码呀,数据库名称呀;成功就说明项目里的properties或者yaml配置文件写错了,某个字母输错了比如database写成datebase之类的