You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2020/01/17 06:53:49 UTC
[GitHub] [incubator-shardingsphere] KomachiSion opened a new issue #4005:
sharding-jdbc-spring-boot-starter can't support NoneShardingStrategy
KomachiSion opened a new issue #4005: sharding-jdbc-spring-boot-starter can't support NoneShardingStrategy
URL: https://github.com/apache/incubator-shardingsphere/issues/4005
## Bug Report
Related issue #3977 .
### Which version of ShardingSphere did you use?
4.0.0-RC1 ~ 4.0.0
### Which project did you use? Sharding-JDBC or Sharding-Proxy?
Sharding-JDBC
### Expected behavior
```yaml
spring:
shardingsphere:
sharding:
tables:
t_order:
actualDataNodes: ds$->{0..1}.t_order
databaseStrategy:
inline:
shardingColumn: order_id
algorithmExpression: ds$->{order_id % 2}
tableStrategy:
none: {}
```
tableStrategy in shardingRule of `t_order` is NoneStrategy.
### Actual behavior
tableStrategy is null.
### Reason analyze (If you can)
spring-boot will process yaml parse result to properties.
So if the value is empty map or collection, it will ignore this propertries.
And then when instance bean, spring boot find there are no properties for `tableStrategy`, and skip instance `tableStrategy`.
detail see `YamlProcessor` in `org.springframework.beans.factory.config` And `ValueObjectBinder` in ` org.springframework.boot.context.properties.bind`.
### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
configuration:
```yaml
spring:
shardingsphere:
datasource:
names: ds0, ds1
ds0:
type: org.apache.commons.dbcp2.BasicDataSource
driverClassName: com.mysql.jdbc.Driver
url: jdbc:mysql://localhost:3306/demo_ds_0?useUnicode=true
username: root
password:
ds1:
type: org.apache.commons.dbcp2.BasicDataSource
driverClassName: com.mysql.jdbc.Driver
url: jdbc:mysql://localhost:3306/demo_ds_1?useUnicode=true
username: root
password:
sharding:
tables:
t_order:
actualDataNodes: ds$->{0..1}.t_order
databaseStrategy:
inline:
shardingColumn: order_id
algorithmExpression: ds$->{order_id % 2}
tableStrategy:
none: {}
props:
sql:
show: true
```
### Example codes for reproduce this issue (such as a github link).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-shardingsphere] KomachiSion closed issue #4005:
sharding-jdbc-spring-boot-starter can't support NoneShardingStrategy
Posted by GitBox <gi...@apache.org>.
KomachiSion closed issue #4005: sharding-jdbc-spring-boot-starter can't support NoneShardingStrategy
URL: https://github.com/apache/incubator-shardingsphere/issues/4005
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services