spring - Spring:无法配置数据源:未指定“url”属性,无法配置嵌入式数据源
问题描述
我的 application.properties 是:
spring.datasource.url=jdbc:mysql://localhost:3306/bdd_disc?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
spring.datasource.username=root
spring.datasource.password=MP18711922
spring.datasource.testWhileIdle = true
spring.datasource.validationQuery = SELEC 1
# Show or not log for each sql query
spring.jpa.show-sql = true
# Hibernate ddl auto (create, create-drop, update)
spring.jpa.hibernate.ddl-auto = update
# Naming strategy
spring.jpa.hibernate.naming-strategy = org.hibernate.cfg.ImprovedNamingStrategy
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect
当我进行 maven Build 并尝试运行主 SpringBoot 类时,我收到以下消息:
Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
解决方案
好的,我通过添加发现了问题:
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
在 application.properties 中。
对不起...
推荐阅读
- php - 连接到 CommissionJunction 令牌时出错:[60] SSL 证书问题:无法获取本地颁发者证书
- c# - 使用 OpenXML 格式列作为文本创建电子表格
- ios - 我正在尝试从数据库中删除数据,但有时数据会被删除,有时数据不会被删除
- sql - 选择内连接返回错误结果
- c# - 使用 $ 插值和 @ 编码进行字符串转义
- xamarin - Xamarin 表单自定义选择器 SelectItem 绑定不起作用
- sql - 光标不循环所有记录
- azure - Azure ApplicationInsights 指标语法?- 内部服务器故障
- ffmpeg - FFMPEG 视频从图像到 nvidia GPU 中的 mp4
- http - 在 golang 服务器中面临 cors 问题