Loading RELEASE-NOTES.md +3 −0 Original line number Diff line number Diff line Loading @@ -3,6 +3,9 @@ ### 功能提升 1. [ISSUE #475](https://github.com/shardingjdbc/sharding-jdbc/issues/475) 支持create index语句 ### 缺陷修正 1. [ISSUE #521](https://github.com/shardingjdbc/sharding-jdbc/issues/521) YAML文件中ShardingProperties设置无效 ## 2.0.1 ### 功能提升 Loading sharding-jdbc-core/src/main/java/io/shardingjdbc/core/constant/ShardingProperties.java +10 −1 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package io.shardingjdbc.core.constant; import com.google.common.base.Strings; import io.shardingjdbc.core.util.StringUtil; import com.google.common.base.Joiner; Loading Loading @@ -80,7 +81,15 @@ public final class ShardingProperties { */ @SuppressWarnings("unchecked") public <T> T getValue(final ShardingPropertiesConstant shardingPropertiesConstant) { String result = props.getProperty(shardingPropertiesConstant.getKey(), shardingPropertiesConstant.getDefaultValue()); String result = props.getProperty(shardingPropertiesConstant.getKey()); if (Strings.isNullOrEmpty(result)) { Object obj = props.get(shardingPropertiesConstant.getKey()); if (null == obj) { result = shardingPropertiesConstant.getDefaultValue(); } else { result = obj.toString(); } } if (boolean.class == shardingPropertiesConstant.getType()) { return (T) Boolean.valueOf(result); } Loading sharding-jdbc-core/src/test/java/io/shardingjdbc/core/yaml/sharding/YamlShardingIntegrateTest.java +3 −1 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import com.google.common.collect.Sets; import io.shardingjdbc.core.api.ConfigMapContext; import io.shardingjdbc.core.api.ShardingDataSourceFactory; import io.shardingjdbc.core.constant.ShardingProperties; import io.shardingjdbc.core.constant.ShardingPropertiesConstant; import io.shardingjdbc.core.yaml.AbstractYamlDataSourceTest; import lombok.RequiredArgsConstructor; import org.junit.Test; Loading @@ -44,6 +45,7 @@ import java.util.concurrent.ConcurrentHashMap; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import static org.junit.Assert.assertTrue; @RunWith(Parameterized.class) @RequiredArgsConstructor Loading Loading @@ -83,7 +85,7 @@ public class YamlShardingIntegrateTest extends AbstractYamlDataSourceTest { field.setAccessible(true); } ShardingProperties shardingProperties = (ShardingProperties) field.get(dataSource); //assertTrue((Boolean) shardingProperties.getValue(ShardingPropertiesConstant.SQL_SHOW)); assertTrue((Boolean) shardingProperties.getValue(ShardingPropertiesConstant.SQL_SHOW)); } Map<String, Object> configMap = new ConcurrentHashMap<>(); configMap.put("key1", "value1"); Loading Loading
RELEASE-NOTES.md +3 −0 Original line number Diff line number Diff line Loading @@ -3,6 +3,9 @@ ### 功能提升 1. [ISSUE #475](https://github.com/shardingjdbc/sharding-jdbc/issues/475) 支持create index语句 ### 缺陷修正 1. [ISSUE #521](https://github.com/shardingjdbc/sharding-jdbc/issues/521) YAML文件中ShardingProperties设置无效 ## 2.0.1 ### 功能提升 Loading
sharding-jdbc-core/src/main/java/io/shardingjdbc/core/constant/ShardingProperties.java +10 −1 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package io.shardingjdbc.core.constant; import com.google.common.base.Strings; import io.shardingjdbc.core.util.StringUtil; import com.google.common.base.Joiner; Loading Loading @@ -80,7 +81,15 @@ public final class ShardingProperties { */ @SuppressWarnings("unchecked") public <T> T getValue(final ShardingPropertiesConstant shardingPropertiesConstant) { String result = props.getProperty(shardingPropertiesConstant.getKey(), shardingPropertiesConstant.getDefaultValue()); String result = props.getProperty(shardingPropertiesConstant.getKey()); if (Strings.isNullOrEmpty(result)) { Object obj = props.get(shardingPropertiesConstant.getKey()); if (null == obj) { result = shardingPropertiesConstant.getDefaultValue(); } else { result = obj.toString(); } } if (boolean.class == shardingPropertiesConstant.getType()) { return (T) Boolean.valueOf(result); } Loading
sharding-jdbc-core/src/test/java/io/shardingjdbc/core/yaml/sharding/YamlShardingIntegrateTest.java +3 −1 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import com.google.common.collect.Sets; import io.shardingjdbc.core.api.ConfigMapContext; import io.shardingjdbc.core.api.ShardingDataSourceFactory; import io.shardingjdbc.core.constant.ShardingProperties; import io.shardingjdbc.core.constant.ShardingPropertiesConstant; import io.shardingjdbc.core.yaml.AbstractYamlDataSourceTest; import lombok.RequiredArgsConstructor; import org.junit.Test; Loading @@ -44,6 +45,7 @@ import java.util.concurrent.ConcurrentHashMap; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import static org.junit.Assert.assertTrue; @RunWith(Parameterized.class) @RequiredArgsConstructor Loading Loading @@ -83,7 +85,7 @@ public class YamlShardingIntegrateTest extends AbstractYamlDataSourceTest { field.setAccessible(true); } ShardingProperties shardingProperties = (ShardingProperties) field.get(dataSource); //assertTrue((Boolean) shardingProperties.getValue(ShardingPropertiesConstant.SQL_SHOW)); assertTrue((Boolean) shardingProperties.getValue(ShardingPropertiesConstant.SQL_SHOW)); } Map<String, Object> configMap = new ConcurrentHashMap<>(); configMap.put("key1", "value1"); Loading