前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >使用ShardingSphere 过程中遇到的关于spring boot 版本的问题

使用ShardingSphere 过程中遇到的关于spring boot 版本的问题

原创
作者头像
猎户星座1
修改2020-10-16 10:14:59
18.8K0
修改2020-10-16 10:14:59
举报
文章被收录于专栏:Java StudyJava Study

直接上关键词吧 不是什么技术文章,采坑记录一下 写完还得去自己做实验 手动狗头

代码语言:javascript
复制
org.springframework.beans.factory.BeanCreationException: Error creating bean with name

  'org.apache.shardingsphere.shardingjdbc.spring.boot.SpringBootConfiguration': 
  Initialization of bean failed; nested exception is org.apache.shardingsphere.core.exception.ShardingException: 
  Can't find datasource type!

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.shardingsphere.shardingjdbc.spring.boot.SpringBootConfiguration': Initialization of bean failed; nested exception is org.apache.shardingsphere.core.exception.ShardingException: Can't find datasource type!

Can't find datasource type!

这个数据源类型: 还记得springboot 会默认一个数据源的链接类型,

报错向下看:

Caused by: java.lang.ClassNotFoundException: com.zaxxer.hikari.HikariDataSource

com.zaxxer.hikari.HikariDataSource 这个应该眼熟点吧

ShardingSphere 的官方git上的demo 使用的spring boot 版本是 1.5.17 然后我也使用的这个版本,配置好配置文件后,但启动springboot后 报了上面这个错误。

奇怪当我启动官方的demo 时是没有出错的啊,后来看到下面的这个错

Caused by: java.lang.ClassNotFoundException: com.zaxxer.hikari.HikariDataSource 又看了官方的demo ,是自己在pom中引入的 HikariDataSource 的,我自己也引入后,启动成功。

spirng boot 2 x 是要默认把 com.zaxxer.hikari.HikariDataSource 作为数据源的。

spring boot 1.5的 application.properties 的设置中 是可以由“_” 下划线的,但sprng boot 不知道哪个版本后就会不能使用 必须用“-”

中横向替换

翻译都能看懂些应该:

Description:

Configuration property name 'spring.shardingsphere.datasource.ds_master' is not valid:

Invalid characters: '_' // 非法

Bean: contentControlle

Reason: Canonical names should be kebab-case ('-' separated), lowercase alpha-numeric characters and must start with a lette // 应该用- 代替

Action:

Modify 'spring.shardingsphere.datasource.ds_master' so that it conforms to the canonical names requirements.

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • Caused by: java.lang.ClassNotFoundException: com.zaxxer.hikari.HikariDataSource
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档