jdbcUrl is required with driverClassName错误解决

Posted jpfss

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了jdbcUrl is required with driverClassName错误解决相关的知识,希望对你有一定的参考价值。

          jdbcUrl is required with driverClassName


springboot2.0配置多数据源:

spring.datasource.primary.url=jdbc:mysql://localhost:3306/study?useUnicode=true&characterEncoding=utf-8&useSSL=true
spring.datasource.primary.username=root
spring.datasource.primary.password=root
spring.datasource.primary.driver-class=com.mysql.cj.jdbc.Driver

spring.datasource.secondary.url=jdbc:mysql://localhost:3306/study?useUnicode=true&characterEncoding=utf-8&useSSL=true
spring.datasource.secondary.username=root
spring.datasource.secondary.password=root
spring.datasource.secondary.driver-class=com.mysql.cj.jdbc.Driver

改为:

spring.datasource.primary.jdbc-url=jdbc:mysql://localhost:3306/study?useUnicode=true&characterEncoding=utf-8&useSSL=true
spring.datasource.primary.username=root
spring.datasource.primary.password=root
spring.datasource.primary.driver-class-name=com.mysql.cj.jdbc.Driver

spring.datasource.secondary.jdbc-url=jdbc:mysql://localhost:3306/study?useUnicode=true&characterEncoding=utf-8&useSSL=true
spring.datasource.secondary.username=root
spring.datasource.secondary.password=root
spring.datasource.secondary.driver-class-name=com.mysql.cj.jdbc.Driver


spring.datasource.url 数据库的 JDBC URL。

spring.datasource.jdbc-url 用来重写自定义连接池

官方文档的解释是:

因为连接池的实际类型没有被公开,所以在您的自定义数据源的元数据中没有生成密钥,而且在IDE中没有完成(因为DataSource接口没有暴露属性)。另外,如果您碰巧在类路径上有Hikari,那么这个基本设置就不起作用了,因为Hikari没有url属性(但是确实有一个jdbcUrl属性)。在这种情况下,您必须重写您的配置如下:

原文地址:https://blog.csdn.net/newbie_907486852/article/details/81391525

以上是关于jdbcUrl is required with driverClassName错误解决的主要内容,如果未能解决你的问题,请参考以下文章

Spring boot: java.lang.IllegalArgumentException: jdbcUrl is required with driverClassName

Spring boot + hikari - dataSource or dataSourceClassName or jdbcUrl is required issue

pip is configured with locations that require TLS/SSL问题

pip is configured with locations that require TLS/SSL, however the ssl module in Python is not avail

pip is configured with locations that require TLS/SSL, however the ssl module in Python is not 解决方法(

Springdata mongodb 版本兼容 引起 Error [The 'cursor' option is required, except for aggregate with