春季:无法配置数据源:未指定'url'属性,并且无法配置任何嵌入式数据源

时间:2019-03-17 07:49:46

标签: spring

我的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.

1 个答案:

答案 0 :(得分:0)

好的,我通过添加发现问题:

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

在application.properties中。

对不起...