直接上关键词吧 不是什么技术文章,采坑记录一下 写完还得去自己做实验 手动狗头
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 会默认一个数据源的链接类型,
报错向下看:
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 删除。