Hi, please use English

------------------

Liang Zhang (John)
Apache ShardingSphere & Dubbo


[email protected] <[email protected]> 于2019年10月31日周四 下午8:36写道:

> hi:
>
> spring的版本为5.0.4-release,在使用shardingsphere-4.0.0-RC2版本的时候,,原有老版本配置(sharding-sphere:3.0.0.M3)的分表策略在该版本下项目启动的时候报错;后来核对了下新老sharding的分表策略,在使用上面做了修改
>
> 老版本
> <sharding:inline-strategy id="xxx"
>                           sharding-column="asset_acct_id"
>
> algorithm-expression="xxx_${Long.valueOf(asset_acct_id.substring(asset_acct_id.length()
> - 4, asset_acct_id.length())) % 10}"/>
> 新版本
> <sharding:inline-strategy id="xxx"
>                           sharding-column="asset_acct_id"
>
> algorithm-expression="xxx_$->{Long.valueOf(asset_acct_id.substring(asset_acct_id.length()
> - 4, asset_acct_id.length())) % 10}"/>
> 修改前报错的信息如下:
> 2019-10-31 14:19:30,238 ERROR [main] o.s.boot.SpringApplication
> [SpringApplication.java : 833] Application run failed
> org.springframework.beans.factory.BeanDefinitionStoreException: Invalid
> bean definition with name 'MhtUserAccountNavTableShardingStrategy' defined
> in null: Could not resolve placeholder
> 'Long.valueOf(asset_acct_id.substring(asset_acct_id.length() - 4,
> asset_acct_id.length())) % 10' in value
> "mht_user_acct_nav_${Long.valueOf(asset_acct_id.substring(asset_acct_id.length()
> - 4, asset_acct_id.length())) % 10}"; nested exception is
> java.lang.IllegalArgumentException: Could not resolve placeholder
> 'Long.valueOf(asset_acct_id.substring(asset_acct_id.length() - 4,
> asset_acct_id.length())) % 10' in value
> "mht_user_acct_nav_${Long.valueOf(asset_acct_id.substring(asset_acct_id.length()
> - 4, asset_acct_id.length())) % 10}"
> at
> org.springframework.beans.factory.config.PlaceholderConfigurerSupport.doProcessProperties(PlaceholderConfigurerSupport.java:228)
> at
> org.springframework.context.support.PropertySourcesPlaceholderConfigurer.processProperties(PropertySourcesPlaceholderConfigurer.java:182)
> at
> org.springframework.context.support.PropertySourcesPlaceholderConfigurer.postProcessBeanFactory(PropertySourcesPlaceholderConfigurer.java:157)
> at
> org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:284)
> at
> org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:164)
> at
> org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:693)
> at
> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:531)
> at
> org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140)
> at
> org.springframework.boot.SpringApplication.refresh(SpringApplication.java:752)
> at
> org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:388)
> at
> org.springframework.boot.SpringApplication.run(SpringApplication.java:327)
> at
> org.springframework.boot.SpringApplication.run(SpringApplication.java:1246)
> at
> org.springframework.boot.SpringApplication.run(SpringApplication.java:1234)
> at com.qiangungun.merchant.WebApplication.main(WebApplication.java:30)
>
>
>

Reply via email to