springboot2.0.0配置多數(shù)據(jù)源出現(xiàn)jdbcUrl is required with driverClassName的錯(cuò)誤
在Spring Boot 2.0配置多數(shù)據(jù)源和Spring Boot 1.5.x之前,一些配置及用法多少有些不同,其中一個(gè)問題就是“jdbcUrl is required with driverClassName.”的錯(cuò)誤
解決辦法:
在配置文件中使用spring.datasource.jdbc-url,而不是通常使用的spring.datasource.url
spring: datasource: master: jdbc-url: jdbc:postgresql://192.168.1.2:5432/test?useUnicode=true&characterEncoding=utf8 username: postgres password: postgres driverClassName: org.postgresql.Driver maxActive: 10 maxIdle: 3 worker: jdbc-url: jdbc:postgresql://192.168.1.3:5432/test?useUnicode=true&characterEncoding=utf8 username: postgres password: postgres driverClassName: org.postgresql.Driver maxActive: 10 maxIdle: 3
第二種方法:
在數(shù)據(jù)源配置時(shí)使用DataSourceProperties方法。
到此這篇關(guān)于springboot2.0.0配置多數(shù)據(jù)源出現(xiàn)jdbcUrl is required with driverClassName的錯(cuò)誤的文章就介紹到這了,更多相關(guān)springboot多數(shù)據(jù)源錯(cuò)誤內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
- spring boot使用sharding jdbc的配置方式
- 詳解springboot采用多數(shù)據(jù)源對(duì)JdbcTemplate配置的方法
- SpringBoot多數(shù)據(jù)源配置詳細(xì)教程(JdbcTemplate、mybatis)
- 詳解Springboot之整合JDBCTemplate配置多數(shù)據(jù)源
- springboot+springJdbc+postgresql 實(shí)現(xiàn)多數(shù)據(jù)源的配置
- springboot實(shí)現(xiàn)以代碼的方式配置sharding-jdbc水平分表
- SpringBoot3+ShardingJDBC5.5.0 讀寫分離配置的實(shí)現(xiàn)
- SpringBoot?配置多個(gè)JdbcTemplate的實(shí)現(xiàn)步驟
- SpringBoot+MybatisPlus+jdbc連接池配置多數(shù)據(jù)源的實(shí)現(xiàn)
- Spring?JDBC配置與使用的實(shí)現(xiàn)
相關(guān)文章
mybatis-plus雪花算法自動(dòng)生成機(jī)器id原理及源碼
Mybatis-Plus是一個(gè)Mybatis的增強(qiáng)工具,它在Mybatis的基礎(chǔ)上做了增強(qiáng),卻不做改變,Mybatis-Plus是為簡(jiǎn)化開發(fā)、提高開發(fā)效率而生,但它也提供了一些很有意思的插件,比如SQL性能監(jiān)控、樂觀鎖、執(zhí)行分析等,下面一起看看mybatis-plus雪花算法自動(dòng)生成機(jī)器id原理解析2021-06-06SpringBoot整合rockerMQ消息隊(duì)列詳解
今天和大家一起深入生產(chǎn)級(jí)別消息中間件 - RocketMQ 的內(nèi)核實(shí)現(xiàn),來(lái)看看真正落地能支撐萬(wàn)億級(jí)消息容量、低延遲的消息隊(duì)列到底是如何設(shè)計(jì)的。我會(huì)先介紹整體的架構(gòu)設(shè)計(jì),然后再深入各核心模塊的詳細(xì)設(shè)計(jì)、核心流程的剖析2022-07-07