zjcnb opened a new issue #10633:
URL: https://github.com/apache/shardingsphere/issues/10633


   ### Which version of ShardingSphere did you use?
   
   5.0.0.alpha
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   
   ShardingSphere-JDBC
   
   ### Expected behavior
   
   SpringBoot 2.4.6,  It starts up properly
   
   > 
   spring:
     shardingsphere:
       # 展示修改以后的sql语句
       props:
         sql-show: true
       datasource:
         common:
           driver-class-name: com.mysql.jdbc.Driver
           type: com.alibaba.druid.pool.DruidDataSource
         names: ds0
         ds0:
           username: root
           password: 123456
           url: 
jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2b8
       rules:
         sharding:
           sharding-algorithms:
             table-inline:
               type: INLINE
               props:
                 algorithm-expression: t_user$->{sharding_key % 4}
           tables:
             t_user:
               actual-data-nodes: ds0.t_user$->{0..3}
               table-strategy:
                 standard:
                   sharding-column: sharding_key
                   sharding-algorithm-name: table-inline
   
   ### Actual behavior
   
   > java.lang.reflect.InvocationTargetException: null
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
~[na:1.8.0_211]
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
~[na:1.8.0_211]
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 ~[na:1.8.0_211]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_211]
        at 
org.apache.shardingsphere.spring.boot.util.PropertyUtil.v2(PropertyUtil.java:111)
 ~[shardingsphere-jdbc-spring-boot-starter-infra-5.0.0-alpha.jar:5.0.0-alpha]
        at 
org.apache.shardingsphere.spring.boot.util.PropertyUtil.handle(PropertyUtil.java:75)
 ~[shardingsphere-jdbc-spring-boot-starter-infra-5.0.0-alpha.jar:5.0.0-alpha]
        at 
org.apache.shardingsphere.spring.boot.registry.AbstractAlgorithmProvidedBeanRegistry.registerBean(AbstractAlgorithmProvidedBeanRegistry.java:50)
 ~[shardingsphere-jdbc-spring-boot-starter-infra-5.0.0-alpha.jar:5.0.0-alpha]
        at 
org.apache.shardingsphere.sharding.spring.boot.algorithm.KeyGenerateAlgorithmProvidedBeanRegistry.postProcessBeanDefinitionRegistry(KeyGenerateAlgorithmProvidedBeanRegistry.java:38)
 ~[shardingsphere-sharding-spring-boot-starter-5.0.0-alpha.jar:5.0.0-alpha]
        at 
org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:311)
 ~[spring-context-5.3.7.jar:5.3.7]
        at 
org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:142)
 ~[spring-context-5.3.7.jar:5.3.7]
        at 
org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:746)
 ~[spring-context-5.3.7.jar:5.3.7]
        at 
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:564)
 ~[spring-context-5.3.7.jar:5.3.7]
        at 
org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:144)
 ~[spring-boot-2.4.6.jar:2.4.6]
        at 
org.springframework.boot.SpringApplication.refresh(SpringApplication.java:771) 
[spring-boot-2.4.6.jar:2.4.6]
        at 
org.springframework.boot.SpringApplication.refresh(SpringApplication.java:763) 
[spring-boot-2.4.6.jar:2.4.6]
        at 
org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:438)
 [spring-boot-2.4.6.jar:2.4.6]
        at 
org.springframework.boot.SpringApplication.run(SpringApplication.java:339) 
[spring-boot-2.4.6.jar:2.4.6]
        at 
org.springframework.boot.SpringApplication.run(SpringApplication.java:1329) 
[spring-boot-2.4.6.jar:2.4.6]
        at 
org.springframework.boot.SpringApplication.run(SpringApplication.java:1318) 
[spring-boot-2.4.6.jar:2.4.6]
        at com.example.demo.DemoApplication.main(DemoApplication.java:14) 
[classes/:na]
   Caused by: java.util.NoSuchElementException: No value bound
        at 
org.springframework.boot.context.properties.bind.BindResult.get(BindResult.java:55)
 ~[spring-boot-2.4.6.jar:2.4.6]
        ... 20 common frames omitted
   
   Exception in thread "main" java.lang.reflect.UndeclaredThrowableException
        at 
org.springframework.util.ReflectionUtils.rethrowRuntimeException(ReflectionUtils.java:147)
        at 
org.springframework.boot.SpringApplication.handleRunFailure(SpringApplication.java:834)
        at 
org.springframework.boot.SpringApplication.run(SpringApplication.java:349)
        at 
org.springframework.boot.SpringApplication.run(SpringApplication.java:1329)
        at 
org.springframework.boot.SpringApplication.run(SpringApplication.java:1318)
        at com.example.demo.DemoApplication.main(DemoApplication.java:14)
   Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at 
org.apache.shardingsphere.spring.boot.util.PropertyUtil.v2(PropertyUtil.java:111)
        at 
org.apache.shardingsphere.spring.boot.util.PropertyUtil.handle(PropertyUtil.java:75)
        at 
org.apache.shardingsphere.spring.boot.registry.AbstractAlgorithmProvidedBeanRegistry.registerBean(AbstractAlgorithmProvidedBeanRegistry.java:50)
        at 
org.apache.shardingsphere.sharding.spring.boot.algorithm.KeyGenerateAlgorithmProvidedBeanRegistry.postProcessBeanDefinitionRegistry(KeyGenerateAlgorithmProvidedBeanRegistry.java:38)
        at 
org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:311)
        at 
org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:142)
        at 
org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:746)
        at 
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:564)
        at 
org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:144)
        at 
org.springframework.boot.SpringApplication.refresh(SpringApplication.java:771)
        at 
org.springframework.boot.SpringApplication.refresh(SpringApplication.java:763)
        at 
org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:438)
        at 
org.springframework.boot.SpringApplication.run(SpringApplication.java:339)
        ... 3 more
   Caused by: java.util.NoSuchElementException: No value bound
        at 
org.springframework.boot.context.properties.bind.BindResult.get(BindResult.java:55)
        ... 20 more
   
   ### Reason analyze (If you can)
   
   sharding.key-generators not configured,  But it still initializes 
KeyGenerateAlgorithmProvidedBeanRegistry  when project start 
   


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

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


Reply via email to