lly835 opened a new issue #8382:
URL: https://github.com/apache/shardingsphere/issues/8382


   ## Bug Report
   
   **For English only**, other languages will not accept.
   
   Before report a bug, make sure you have:
   
   - Searched open and closed [GitHub 
issues](https://github.com/apache/shardingsphere/issues).
   - Read documentation: [ShardingSphere 
Doc](https://shardingsphere.apache.org/document/current/en/overview).
   
   Please pay attention on issues you submitted, because we maybe need more 
details. 
   If no response anymore and we cannot reproduce it on current information, we 
will **close it**.
   
   Please answer these questions before submitting your issue. Thanks!
   
   ### Which version of ShardingSphere did you use?
   ```
   <parent>
           <groupId>org.springframework.boot</groupId>
           <artifactId>spring-boot-starter-parent</artifactId>
           <version>2.3.2.RELEASE</version>
       </parent>
   
   <dependency>
               <groupId>org.apache.shardingsphere</groupId>
               
<artifactId>shardingsphere-jdbc-core-spring-boot-starter</artifactId>
               <version>5.0.0-alpha</version>
   </dependency>
   ```
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   ShardingSphere-JDBC
   
   ```
   # 配置真实数据源
   spring.shardingsphere.datasource.names=ds0,ds1
   
   
spring.shardingsphere.datasource.common.type=com.zaxxer.hikari.HikariDataSource
   
spring.shardingsphere.datasource.common.driver-class-name=com.mysql.jdbc.Driver
   spring.shardingsphere.datasource.common.username=root
   spring.shardingsphere.datasource.common.password= 123456
   
   
spring.shardingsphere.datasource.ds0.jdbc-url=jdbc:mysql://localhost:3306/ds0?serverTimezone=UTC&useSSL=false
   
spring.shardingsphere.datasource.ds1.jdbc-url=jdbc:mysql://localhost:3306/ds1?serverTimezone=UTC&useSSL=false
   
   # 配置 t_order 表规则
   
spring.shardingsphere.rules.sharding.tables.t_order.actual-data-nodes=ds$->{0..1}.t_order$->{0..1}
   
   # 配置分库策略
   
spring.shardingsphere.rules.sharding.tables.t_order.database-strategy.standard.sharding-column=user_id
   
spring.shardingsphere.rules.sharding.tables.t_order.database-strategy.standard.sharding-algorithm-name=database_inline
   
   # 配置分表策略
   
spring.shardingsphere.rules.sharding.tables.t_order.table-strategy.standard.sharding-column=order_id
   
spring.shardingsphere.rules.sharding.tables.t_order.table-strategy.standard.sharding-algorithm-name=table_inline
   
   # 配置 分片算法
   
spring.shardingsphere.rules.sharding.sharding-algorithms.database_inline.type=INLINE
   
spring.shardingsphere.rules.sharding.sharding-algorithms.database_inline.props.algorithm-expression=ds_${user_id
 % 2}
   
spring.shardingsphere.rules.sharding.sharding-algorithms.table_inline.type=INLINE
   
spring.shardingsphere.rules.sharding.sharding-algorithms.table_inline.props.algorithm-expression=t_order_${order_id
 % 2}
   ```
   
   
   ### Expected behavior
   
   ### Actual behavior
   ```
   Configuration property name 
'spring.shardingsphere.rules.sharding.sharding-algorithms.database_inline.props'
 is not valid:
   
       Invalid characters: '_'
       Reason: Canonical names should be kebab-case ('-' separated), lowercase 
alpha-numeric characters and must start with a letter
   
   ```
    fix it.
   
   ```
   # 配置真实数据源
   spring.shardingsphere.datasource.names=ds0,ds1
   
   
spring.shardingsphere.datasource.common.type=com.zaxxer.hikari.HikariDataSource
   
spring.shardingsphere.datasource.common.driver-class-name=com.mysql.jdbc.Driver
   spring.shardingsphere.datasource.common.username=root
   spring.shardingsphere.datasource.common.password= 123456
   
   
spring.shardingsphere.datasource.ds0.jdbc-url=jdbc:mysql://localhost:3306/ds0?serverTimezone=UTC&useSSL=false
   
spring.shardingsphere.datasource.ds1.jdbc-url=jdbc:mysql://localhost:3306/ds1?serverTimezone=UTC&useSSL=false
   
   # 配置 t_order 表规则
   
spring.shardingsphere.rules.sharding.tables.t_order.actual-data-nodes=ds$->{0..1}.t_order$->{0..1}
   
   # 配置分库策略
   
spring.shardingsphere.rules.sharding.tables.t_order.database-strategy.standard.sharding-column=user_id
   
spring.shardingsphere.rules.sharding.tables.t_order.database-strategy.standard.sharding-algorithm-name=databaseinline
   
   # 配置分表策略
   
spring.shardingsphere.rules.sharding.tables.t_order.table-strategy.standard.sharding-column=order_id
   
spring.shardingsphere.rules.sharding.tables.t_order.table-strategy.standard.sharding-algorithm-name=tableinline
   
   # 配置 分片算法
   
spring.shardingsphere.rules.sharding.sharding-algorithms.databaseinline.type=INLINE
   
spring.shardingsphere.rules.sharding.sharding-algorithms.databaseinline.props.algorithm-expression=ds_${user_id
 % 2}
   
spring.shardingsphere.rules.sharding.sharding-algorithms.tableinline.type=INLINE
   
spring.shardingsphere.rules.sharding.sharding-algorithms.tableinline.props.algorithm-expression=t_order_${order_id
 % 2}
   ```
   
   Application run failed
   ```
   2020-11-27 18:28:08.224 ERROR 46307 --- [           main] 
o.s.boot.SpringApplication               : Application run failed
   
   java.lang.reflect.InvocationTargetException: null
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
~[na:1.8.0_251]
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
~[na:1.8.0_251]
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 ~[na:1.8.0_251]
   
   ```
   
   ### Reason analyze (If you can)
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule 
configuration, when exception occur etc.
   
   ### 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:
[email protected]


Reply via email to