Java 未能配置数据源:';url';属性未使用Spring引导指定

Java 未能配置数据源:';url';属性未使用Spring引导指定,java,spring,spring-boot,Java,Spring,Spring Boot,这是我第一次做一个简单的春季启动积垢我遇到的问题 Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured. Reason: Failed to determine a suitable driver class 我不知道如何解决问题,我添加了正确的方式,但我得到了错误,请解决这个问题 应用程序属性 spring.dataso

这是我第一次做一个简单的春季启动积垢我遇到的问题

Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
Reason: Failed to determine a suitable driver class
我不知道如何解决问题,我添加了正确的方式,但我得到了错误,请解决这个问题

应用程序属性

spring.datasource.url=jdbc:mysql://localhost:3306/mlab
spring.datasource.username=root
spring.datasource.password=
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
porm.xml

<dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
    <scope>runtime</scope>
</dependency>

mysql
mysql连接器java
运行时

您似乎未能提供驱动程序类名

spring.datasource.url=jdbc:mysql://localhost:3306/mlab
spring.datasource.username=root
spring.datasource.password=
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
你可以参考:


添加上述属性后,应该可以正常工作。

您可以尝试在应用程序中添加驱动程序类。属性

spring.datasource.url=jdbc:mysql://localhost:3306/mlab
spring.datasource.username=root
spring.datasource.password=
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
您还可以根据需要添加和修改以下内容

spring.jpa.database-platform = org.hibernate.dialect.MySQL5Dialect
spring.jpa.generate-ddl=true
spring.jpa.hibernate.ddl-auto = update

spring.datasource.driver类名=com.mysql.jdbc.driver-spring.datasource.url=jdbc:mysql://localhost:3306/mlab spring.datasource.username=root-spring.datasource.password=i添加了这个sames错误您能检查一下您是否在pom.xmlspring-boot-starter-data-jpa中添加了
spring-boot-starter数据jpa
您是否可以通过github共享整个代码库?我脑子里想不出别的东西了。也许在查看了整个代码库之后,我可以提供帮助。在此之前,您可以尝试将驱动程序属性名称重命名为
spring.datasource.drivercassname
n:服务器时区值“unknown”无法识别或表示多个时区。如果要利用时区支持,必须配置服务器或JDBC驱动程序(通过“serverTimezone”配置属性)以使用更具体的时区值。