Closed wangjianwen closed 6 years ago
Please answer these questions before submitting your issue. Thanks!
sharding-jdbc 2.0.1
spring boot环境能读取inline表达式
启动spring boot时 java.lang.IllegalArgumentException: Could not resolve placeholder '0..1' in value "db_${0..1}.receivedetail${[0, 5]}"
由于项目需求,需要自定义sharding配置文件,自己解析。所以在项目的application.properties文件中,配置sharding规则: xxx.datasource.sharding.tablerule.names=tablerule1 xxx.datasource.sharding.tablerule1.logictable=t1 xxx.datasource.sharding.tablerule1.actualDataNodes=db${0..1}.t1${[0, 5]} xxx.datasource.sharding.tablerule1.databaseShardingStrategyType=standard xxx.datasource.sharding.tablerule1.databaseShardingStrategy.shardingColumn=id xxx.datasource.sharding.tablerule1.databaseShardingStrategy.preciseAlgorithmClassName=ModuloDatabaseShardingAlgorithm xxx.datasource.sharding.tablerule1.tableShardingStrategyType=complex xxx.datasource.sharding.tablerule1.tableShardingStrategy.shardingColumns=name,id xxx.datasource.sharding.tablerule1.tableShardingStrategy.algorithmClassName=ModuloTableShardingAlgorithm
按照FAQ 2中所说,我添加了如下bean配置
@Bean public PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() { PropertySourcesPlaceholderConfigurer p = new PropertySourcesPlaceholderConfigurer(); p.setLocations(new ClassPathResource("application.properties")); p.setIgnoreUnresolvablePlaceholders(true); return p; }
请参考example https://github.com/shardingjdbc/sharding-jdbc-example/tree/dev/sharding-jdbc-spring-boot-example/sharding-jdbc-spring-boot-data-mybatis-example
请问不使用spring boot 呢? 在properties中配置 xxx.datasource.sharding.tablerule1.actualDataNodes=db${0..1}.t1${[0, 5]}
在spring.xml 中使用 ${xxx.datasource.sharding.tablerule1.actualDataNodes} 出错怎么处理?
能不能把解析器中 $ 判断换成别的
404 - page not found
Please answer these questions before submitting your issue. Thanks!
Which version of Sharding-Jdbc do you using?
sharding-jdbc 2.0.1
Expected behavior
spring boot环境能读取inline表达式
Actual behavior
启动spring boot时 java.lang.IllegalArgumentException: Could not resolve placeholder '0..1' in value "db_${0..1}.receivedetail${[0, 5]}"
Steps to reproduce the behavior
由于项目需求,需要自定义sharding配置文件,自己解析。所以在项目的application.properties文件中,配置sharding规则: xxx.datasource.sharding.tablerule.names=tablerule1 xxx.datasource.sharding.tablerule1.logictable=t1 xxx.datasource.sharding.tablerule1.actualDataNodes=db${0..1}.t1${[0, 5]} xxx.datasource.sharding.tablerule1.databaseShardingStrategyType=standard xxx.datasource.sharding.tablerule1.databaseShardingStrategy.shardingColumn=id xxx.datasource.sharding.tablerule1.databaseShardingStrategy.preciseAlgorithmClassName=ModuloDatabaseShardingAlgorithm xxx.datasource.sharding.tablerule1.tableShardingStrategyType=complex xxx.datasource.sharding.tablerule1.tableShardingStrategy.shardingColumns=name,id xxx.datasource.sharding.tablerule1.tableShardingStrategy.algorithmClassName=ModuloTableShardingAlgorithm
按照FAQ 2中所说,我添加了如下bean配置
Please provide the reproduce example codes (such as github link) if possible.