yx9o opened a new issue #11242:
URL: https://github.com/apache/shardingsphere/issues/11242


   **description:**
   Spring boot 2.x does not support underscores in attribute names. In the 
official documentation of ss, there are underscores in attribute names in the 
configuration of the fragmentation algorithm, such as:
   ```
   # Configure sharding algorithm
   
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}
   ```
   I think database_inline and table_inline need to be adjusted and cannot 
contain underscores, because such a configuration will report an error when it 
starts. The error is as follows:
   ```
   ss error: Preconditions.checkNotNull(expression, "Inline sharding algorithm 
expression cannot be null.");
   springboot error: "Configuration property name'" + name + "'is not valid".
   ```
   I think the error report of springboot is clearer, and the user can know 
which attribute in the configuration is wrong or invalid.
   
   and so,
   I expect to be able to output the springboot error in the catch of the 
PropertyUtil.containPropertyPrefix(final Environment environment, final String 
prefix) method. And adjust the underline in the document.
   
   Welcome to leave a comment and discuss.


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to