strongduanmu commented on a change in pull request #13824: URL: https://github.com/apache/shardingsphere/pull/13824#discussion_r757837835
########## File path: docs/document/content/reference/faq/_index.cn.md ########## @@ -334,3 +334,28 @@ ShardingSphere 中很多功能实现类的加载方式是通过 [SPI](/cn/concep 更多关于 alias 使用方法请参考 [Proxool官网](http://proxool.sourceforge.net/configure.html)。 PS:sourceforge 网站需要翻墙访问。 + +## 29. [其他] 使用 Spring Boot 2.x 集成 ShardingSphere 时,配置文件中的属性设置不生效? + +回答: + +需要特别注意,Spring Boot 2.x 环境下 配置文件的属性名称约束为仅允许小写字母、数字和短横线,即`[a-z][0-9]`和`-`。 + +原因如下: + +Spring Boot 2.x 环境下,ShardingSphere 通过 Binder 来绑定配置文件,属性名称不规范(如:驼峰或下划线等)会抛出 `InvalidConfigurationPropertyNameException` 异常。 + +关键代码:`org.apache.shardingsphere.spring.boot.util.PropertyUtil#containPropertyPrefix(Environment, String)` 方法: + +```java + public static boolean containPropertyPrefix(final Environment environment, final String prefix) { Review comment: @cheese8 Can we delete this code example? We only need to tell the user what kind of configuration will not take effect in springboot 2.x, and inform the reason for not taking effect. -- 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]
