弹簧2.6.7:无法配置数据源:' url'属性

发布于 2025-01-26 20:32:07 字数 1215 浏览 4 评论 0原文

我创建了一个新的弹簧启动项目,并在应用程序中指定了。专业DB设置:

spring.jpa.hibernate.ddl-auto=update
spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
spring.jpa.database-platform=org.hibernate.dialect.MySQL5InnoDBDialect
spring.datasource.url=jdbc:mysql://localhost:3306/mydb?&useLegacyDatetimeCode=false&serverTimezone=UTC&useUnicode=yes&character_set_server=utf8mb4
spring.datasource.username=.....
spring.datasource.password=.....

在pom.xml中,我有mysql依赖关系:

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

我也完成了maven-&gt;更新 ....

启动项目时,控制台说:

***************************
APPLICATION FAILED TO START
***************************

Description:

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

我不理解..我只是提供了他需要的东西... datasource.url ...

当我将弹簧版更改为时2.3.0.Release ...它有效。但是,为什么不使用新的2.6.7(应该稳定)呢?

I have created a new Spring Starter Project and I specified in application.properties the db settings:

spring.jpa.hibernate.ddl-auto=update
spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
spring.jpa.database-platform=org.hibernate.dialect.MySQL5InnoDBDialect
spring.datasource.url=jdbc:mysql://localhost:3306/mydb?&useLegacyDatetimeCode=false&serverTimezone=UTC&useUnicode=yes&character_set_server=utf8mb4
spring.datasource.username=.....
spring.datasource.password=.....

in pom.xml I have the mysql dependency:

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

I have also done maven -> Update....

When starting the project the console says:

***************************
APPLICATION FAILED TO START
***************************

Description:

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

I don´t understand..i just provided what he needs...the datasource.url...

When I change the spring version to 2.3.0.RELEASE...it works. But why not with the newer one 2.6.7 (which should be stable)?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文