springboot2.0.0配置多數(shù)據(jù)源出現(xiàn)jdbcUrl is required with driverClassName的錯誤
在Spring Boot 2.0配置多數(shù)據(jù)源和Spring Boot 1.5.x之前,一些配置及用法多少有些不同,其中一個問題就是“jdbcUrl is required with driverClassName.”的錯誤
解決辦法:
在配置文件中使用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ù)源配置時使用DataSourceProperties方法。
到此這篇關(guān)于springboot2.0.0配置多數(shù)據(jù)源出現(xiàn)jdbcUrl is required with driverClassName的錯誤的文章就介紹到這了,更多相關(guān)springboot多數(shù)據(jù)源錯誤內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
- spring boot使用sharding jdbc的配置方式
- 詳解springboot采用多數(shù)據(jù)源對JdbcTemplate配置的方法
- SpringBoot多數(shù)據(jù)源配置詳細教程(JdbcTemplate、mybatis)
- 詳解Springboot之整合JDBCTemplate配置多數(shù)據(jù)源
- springboot+springJdbc+postgresql 實現(xiàn)多數(shù)據(jù)源的配置
- springboot實現(xiàn)以代碼的方式配置sharding-jdbc水平分表
- SpringBoot3+ShardingJDBC5.5.0 讀寫分離配置的實現(xiàn)
- SpringBoot?配置多個JdbcTemplate的實現(xiàn)步驟
- SpringBoot+MybatisPlus+jdbc連接池配置多數(shù)據(jù)源的實現(xiàn)
- Spring?JDBC配置與使用的實現(xiàn)