2974408285 opened a new issue, #24061:
URL: https://github.com/apache/shardingsphere/issues/24061

   shardingsphere-jdbc-core-spring-boot-starter   version: 5.2.1
   shiro-spring                                                          
version: 1.8.0
   
   场景一:当没有增加shiro配置类时,只使用shardingsphere-jdbc,项目正常运行
   场景二:当没有使用shardingsphere-jdbc时,增加shiro配置类,只使用shiro-spring,项目运行正常
   场景三:当使用shardingsphere-jdbc时,增加shiro配置类,使用shiro-spring,项目启动异常
   
   shiro的配置类ShiroConfig:
   
   package com.ykq.shiro.config;
   
   import com.ykq.shiro.realm.LoginAuthorizingRealm;
   import lombok.extern.slf4j.Slf4j;
   import org.apache.shiro.authc.credential.HashedCredentialsMatcher;
   import org.apache.shiro.mgt.SecurityManager;
   import 
org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor;
   import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
   import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
   import org.springframework.beans.factory.annotation.Autowired;
   import org.springframework.context.annotation.Bean;
   import org.springframework.context.annotation.Configuration;
   import org.springframework.core.annotation.Order;
   
   import java.util.LinkedHashMap;
   import java.util.Map;
   
   /**
    * @author: kqyin
    * @date: 2023/2/8 16:28
    * @Description: shiro配置,
    * 我日,一直报注入Mapper不成功,shardingsphere框架的代码不知道哪里有问题
    */
   @Slf4j
   @Configuration
   public class ShiroConfig {
       @Autowired
       private LoginAuthorizingRealm loginAuthorizingRealm;
   
       @Bean
       public ShiroFilterFactoryBean shiroFilterFactoryBean(SecurityManager 
securityManager) {
           log.info("ShiroConfiguration.shirFilter()");
           ShiroFilterFactoryBean shiroFilterFactoryBean = new 
ShiroFilterFactoryBean();
           shiroFilterFactoryBean.setSecurityManager(securityManager);
           Map<String, String> filterChainDefinitionMap = new LinkedHashMap();
           filterChainDefinitionMap.put("/user/login", "anon");
           filterChainDefinitionMap.put("/", "authc");
           filterChainDefinitionMap.put("/**", "anon");
           filterChainDefinitionMap.put("/logout", "logout");
           shiroFilterFactoryBean.setLoginUrl("/user/login");
           shiroFilterFactoryBean.setSuccessUrl("/user/main");
           shiroFilterFactoryBean.setUnauthorizedUrl("/403");
           
shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap);
           return shiroFilterFactoryBean;
       }
   
       @Bean
       public HashedCredentialsMatcher hashedCredentialsMatcher() {
           HashedCredentialsMatcher hashedCredentialsMatcher = new 
HashedCredentialsMatcher();
           hashedCredentialsMatcher.setHashAlgorithmName("md5");
           hashedCredentialsMatcher.setHashIterations(2);
           return hashedCredentialsMatcher;
       }
   
       @Bean
       public LoginAuthorizingRealm dbShiroRealm() {
           // LoginAuthorizingRealm dbRealm = new LoginAuthorizingRealm();
           
loginAuthorizingRealm.setCredentialsMatcher(this.hashedCredentialsMatcher());
           return loginAuthorizingRealm;
       }
   
       @Bean
       public SecurityManager securityManager() {
           DefaultWebSecurityManager securityManager = new 
DefaultWebSecurityManager();
           securityManager.setRealm(this.dbShiroRealm());
           return securityManager;
       }
   
       @Bean
       public AuthorizationAttributeSourceAdvisor 
authorizationAttributeSourceAdvisor(SecurityManager securityManager) {
           AuthorizationAttributeSourceAdvisor 
authorizationAttributeSourceAdvisor = new AuthorizationAttributeSourceAdvisor();
           
authorizationAttributeSourceAdvisor.setSecurityManager(securityManager);
           return authorizationAttributeSourceAdvisor;
       }
   }
   
   
   shiro的配置类LoginAuthorizingRealm :
   package com.ykq.shiro.realm;
   
   import cn.hutool.core.util.ObjectUtil;
   import com.ykq.clazz.service.ClazzService;
   import com.ykq.school.service.SchoolService;
   import com.ykq.user.entity.User;
   import com.ykq.user.service.UserService;
   import org.apache.shiro.authc.AuthenticationException;
   import org.apache.shiro.authc.AuthenticationInfo;
   import org.apache.shiro.authc.AuthenticationToken;
   import org.apache.shiro.authc.SimpleAuthenticationInfo;
   import org.apache.shiro.authz.AuthorizationInfo;
   import org.apache.shiro.realm.AuthorizingRealm;
   import org.apache.shiro.subject.PrincipalCollection;
   import org.springframework.beans.factory.annotation.Autowired;
   import org.springframework.stereotype.Component;
   
   /**
    * @author: kqyin
    * @date: 2023/2/8 15:12
    * @Description: 登录鉴权
    */
   @Component
   public class LoginAuthorizingRealm extends AuthorizingRealm {
       @Autowired
       private UserService userService;
   
       /**
        * @Author kqyin
        * @Date 2023/2/8 15:16
        * @Description 授权
        */
       @Override
       protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection 
principals) {
           return null;
       }
   
       /**
        * @Author kqyin
        * @Date 2023/2/8 15:16
        * @Description 认证
        */
       @Override
       protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken 
token) throws AuthenticationException {
           String userName = (String) token.getPrincipal();
           User user = userService.queryUserByUserName(userName);
           if (ObjectUtil.isEmpty(user)) {
               return null;
           }
           return new SimpleAuthenticationInfo(user.getUserName(), 
user.getPassword(), super.getName());
       }
   }
   
   
   error report:
   - | [] | [20230208 19:16:50.926] | [ERROR] | [kqyin-home] | [main] | 
[o.s.boot.SpringApplication] | --> Application run failed|
   org.springframework.beans.factory.BeanCreationException: Error creating bean 
with name 'shiroFilterFactoryBean' defined in class path resource 
[com/ykq/shiro/config/ShiroConfig.class]: BeanPostProcessor before 
instantiation of bean failed; nested exception is 
org.springframework.beans.factory.UnsatisfiedDependencyException: Error 
creating bean with name 'shiroConfig': Unsatisfied dependency expressed through 
field 'loginAuthorizingRealm'; nested exception is 
org.springframework.beans.factory.UnsatisfiedDependencyException: Error 
creating bean with name 'loginAuthorizingRealm': Unsatisfied dependency 
expressed through field 'userService'; nested exception is 
org.springframework.beans.factory.UnsatisfiedDependencyException: Error 
creating bean with name 'userServiceImpl': Unsatisfied dependency expressed 
through field 'userMapper'; nested exception is 
org.springframework.beans.factory.UnsatisfiedDependencyException: Error 
creating bean with name 'userMapper' defined in file [D:\sts_
 
workspacce\SpringBootDemo\target\classes\com\ykq\user\mapper\UserMapper.class]: 
Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; 
nested exception is 
org.springframework.beans.factory.UnsatisfiedDependencyException: Error 
creating bean with name 'sqlSessionFactory' defined in class path resource 
[org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class]: 
Unsatisfied dependency expressed through method 'sqlSessionFactory' parameter 
0; nested exception is org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'shardingSphereDataSource' defined in class path 
resource 
[org/apache/shardingsphere/spring/boot/ShardingSphereAutoConfiguration.class]: 
Bean instantiation via factory method failed; nested exception is 
org.springframework.beans.BeanInstantiationException: Failed to instantiate 
[javax.sql.DataSource]: Factory method 'shardingSphereDataSource' threw 
exception; nested exception is java.lang.IllegalStateException:
  Inline sharding algorithm expression cannot be null or empty.
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:511)
        at 
org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324)
        at 
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
        at 
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
        at 
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:207)
        at 
org.springframework.context.support.PostProcessorRegistrationDelegate.registerBeanPostProcessors(PostProcessorRegistrationDelegate.java:241)
        at 
org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:723)
        at 
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:536)
        at 
org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:143)
        at 
org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758)
        at 
org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750)
        at 
org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
        at 
org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
        at 
org.springframework.boot.SpringApplication.run(SpringApplication.java:1237)
        at 
org.springframework.boot.SpringApplication.run(SpringApplication.java:1226)
        at 
com.ykq.SpringBootDemoApplication.main(SpringBootDemoApplication.java:15)
   Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: 
Error creating bean with name 'shiroConfig': Unsatisfied dependency expressed 
through field 'loginAuthorizingRealm'; nested exception is 
org.springframework.beans.factory.UnsatisfiedDependencyException: Error 
creating bean with name 'loginAuthorizingRealm': Unsatisfied dependency 
expressed through field 'userService'; nested exception is 
org.springframework.beans.factory.UnsatisfiedDependencyException: Error 
creating bean with name 'userServiceImpl': Unsatisfied dependency expressed 
through field 'userMapper'; nested exception is 
org.springframework.beans.factory.UnsatisfiedDependencyException: Error 
creating bean with name 'userMapper' defined in file 
[D:\sts_workspacce\SpringBootDemo\target\classes\com\ykq\user\mapper\UserMapper.class]:
 Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; 
nested exception is 
org.springframework.beans.factory.UnsatisfiedDependencyException: Error c
 reating bean with name 'sqlSessionFactory' defined in class path resource 
[org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class]: 
Unsatisfied dependency expressed through method 'sqlSessionFactory' parameter 
0; nested exception is org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'shardingSphereDataSource' defined in class path 
resource 
[org/apache/shardingsphere/spring/boot/ShardingSphereAutoConfiguration.class]: 
Bean instantiation via factory method failed; nested exception is 
org.springframework.beans.BeanInstantiationException: Failed to instantiate 
[javax.sql.DataSource]: Factory method 'shardingSphereDataSource' threw 
exception; nested exception is java.lang.IllegalStateException: Inline sharding 
algorithm expression cannot be null or empty.
        at 
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:643)
        at 
org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:130)
        at 
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399)
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1420)
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593)
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)
        at 
org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324)
        at 
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
        at 
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
        at 
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
        at 
org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:408)
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1336)
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1176)
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:556)
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)
        at 
org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324)
        at 
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
        at 
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
        at 
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:207)
        at 
org.springframework.aop.framework.autoproxy.BeanFactoryAdvisorRetrievalHelper.findAdvisorBeans(BeanFactoryAdvisorRetrievalHelper.java:91)
        at 
org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findCandidateAdvisors(AbstractAdvisorAutoProxyCreator.java:111)
        at 
org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator.findCandidateAdvisors(AnnotationAwareAspectJAutoProxyCreator.java:92)
        at 
org.springframework.aop.aspectj.autoproxy.AspectJAwareAdvisorAutoProxyCreator.shouldSkip(AspectJAwareAdvisorAutoProxyCreator.java:101)
        at 
org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessBeforeInstantiation(AbstractAutoProxyCreator.java:251)
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInstantiation(AbstractAutowireCapableBeanFactory.java:1140)
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.resolveBeforeInstantiation(AbstractAutowireCapableBeanFactory.java:1113)
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:505)
        ... 15 common frames omitted
   Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: 
Error creating bean with name 'loginAuthorizingRealm': Unsatisfied dependency 
expressed through field 'userService'; nested exception is 
org.springframework.beans.factory.UnsatisfiedDependencyException: Error 
creating bean with name 'userServiceImpl': Unsatisfied dependency expressed 
through field 'userMapper'; nested exception is 
org.springframework.beans.factory.UnsatisfiedDependencyException: Error 
creating bean with name 'userMapper' defined in file 
[D:\sts_workspacce\SpringBootDemo\target\classes\com\ykq\user\mapper\UserMapper.class]:
 Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; 
nested exception is 
org.springframework.beans.factory.UnsatisfiedDependencyException: Error 
creating bean with name 'sqlSessionFactory' defined in class path resource 
[org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class]: 
Unsatisfied dependency expressed through method 'sqlSessi
 onFactory' parameter 0; nested exception is 
org.springframework.beans.factory.BeanCreationException: Error creating bean 
with name 'shardingSphereDataSource' defined in class path resource 
[org/apache/shardingsphere/spring/boot/ShardingSphereAutoConfiguration.class]: 
Bean instantiation via factory method failed; nested exception is 
org.springframework.beans.BeanInstantiationException: Failed to instantiate 
[javax.sql.DataSource]: Factory method 'shardingSphereDataSource' threw 
exception; nested exception is java.lang.IllegalStateException: Inline sharding 
algorithm expression cannot be null or empty.
        at 
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:643)
        at 
org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:130)
        at 
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399)
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1420)
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593)
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)
        at 
org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324)
        at 
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
        at 
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
        at 
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
        at 
org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
        at 
org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1307)
        at 
org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1227)
        at 
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:640)
        ... 41 common frames omitted
   Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: 
Error creating bean with name 'userServiceImpl': Unsatisfied dependency 
expressed through field 'userMapper'; nested exception is 
org.springframework.beans.factory.UnsatisfiedDependencyException: Error 
creating bean with name 'userMapper' defined in file 
[D:\sts_workspacce\SpringBootDemo\target\classes\com\ykq\user\mapper\UserMapper.class]:
 Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; 
nested exception is 
org.springframework.beans.factory.UnsatisfiedDependencyException: Error 
creating bean with name 'sqlSessionFactory' defined in class path resource 
[org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class]: 
Unsatisfied dependency expressed through method 'sqlSessionFactory' parameter 
0; nested exception is org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'shardingSphereDataSource' defined in class path 
resource [org/apache/sh
 ardingsphere/spring/boot/ShardingSphereAutoConfiguration.class]: Bean 
instantiation via factory method failed; nested exception is 
org.springframework.beans.BeanInstantiationException: Failed to instantiate 
[javax.sql.DataSource]: Factory method 'shardingSphereDataSource' threw 
exception; nested exception is java.lang.IllegalStateException: Inline sharding 
algorithm expression cannot be null or empty.
        at 
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:643)
        at 
org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:130)
        at 
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399)
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1420)
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593)
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)
        at 
org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324)
        at 
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
        at 
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
        at 
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
        at 
org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
        at 
org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1307)
        at 
org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1227)
        at 
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:640)
        ... 54 common frames omitted
   Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: 
Error creating bean with name 'userMapper' defined in file 
[D:\sts_workspacce\SpringBootDemo\target\classes\com\ykq\user\mapper\UserMapper.class]:
 Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; 
nested exception is 
org.springframework.beans.factory.UnsatisfiedDependencyException: Error 
creating bean with name 'sqlSessionFactory' defined in class path resource 
[org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class]: 
Unsatisfied dependency expressed through method 'sqlSessionFactory' parameter 
0; nested exception is org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'shardingSphereDataSource' defined in class path 
resource 
[org/apache/shardingsphere/spring/boot/ShardingSphereAutoConfiguration.class]: 
Bean instantiation via factory method failed; nested exception is 
org.springframework.beans.BeanInstantiationException: Failed to i
 nstantiate [javax.sql.DataSource]: Factory method 'shardingSphereDataSource' 
threw exception; nested exception is java.lang.IllegalStateException: Inline 
sharding algorithm expression cannot be null or empty.
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:1524)
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1404)
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593)
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)
        at 
org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324)
        at 
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
        at 
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
        at 
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
        at 
org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
        at 
org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1307)
        at 
org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1227)
        at 
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:640)
        ... 67 common frames omitted
   Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: 
Error creating bean with name 'sqlSessionFactory' defined in class path 
resource 
[org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class]: 
Unsatisfied dependency expressed through method 'sqlSessionFactory' parameter 
0; nested exception is org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'shardingSphereDataSource' defined in class path 
resource 
[org/apache/shardingsphere/spring/boot/ShardingSphereAutoConfiguration.class]: 
Bean instantiation via factory method failed; nested exception is 
org.springframework.beans.BeanInstantiationException: Failed to instantiate 
[javax.sql.DataSource]: Factory method 'shardingSphereDataSource' threw 
exception; nested exception is java.lang.IllegalStateException: Inline sharding 
algorithm expression cannot be null or empty.
        at 
org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:797)
        at 
org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:538)
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1336)
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1176)
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:556)
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)
        at 
org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324)
        at 
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
        at 
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
        at 
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
        at 
org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
        at 
org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1307)
        at 
org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1227)
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:1509)
        ... 78 common frames omitted
   Caused by: org.springframework.beans.factory.BeanCreationException: Error 
creating bean with name 'shardingSphereDataSource' defined in class path 
resource 
[org/apache/shardingsphere/spring/boot/ShardingSphereAutoConfiguration.class]: 
Bean instantiation via factory method failed; nested exception is 
org.springframework.beans.BeanInstantiationException: Failed to instantiate 
[javax.sql.DataSource]: Factory method 'shardingSphereDataSource' threw 
exception; nested exception is java.lang.IllegalStateException: Inline sharding 
algorithm expression cannot be null or empty.
        at 
org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:655)
        at 
org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:635)
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1336)
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1176)
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:556)
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)
        at 
org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324)
        at 
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
        at 
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
        at 
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
        at 
org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
        at 
org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1307)
        at 
org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1227)
        at 
org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:884)
        at 
org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:788)
        ... 91 common frames omitted
   Caused by: org.springframework.beans.BeanInstantiationException: Failed to 
instantiate [javax.sql.DataSource]: Factory method 'shardingSphereDataSource' 
threw exception; nested exception is java.lang.IllegalStateException: Inline 
sharding algorithm expression cannot be null or empty.
        at 
org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
        at 
org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:650)
        ... 105 common frames omitted
   Caused by: java.lang.IllegalStateException: Inline sharding algorithm 
expression cannot be null or empty.
        at 
com.google.common.base.Preconditions.checkState(Preconditions.java:508)
        at 
org.apache.shardingsphere.sharding.algorithm.sharding.inline.InlineShardingAlgorithm.getAlgorithmExpression(InlineShardingAlgorithm.java:61)
        at 
org.apache.shardingsphere.sharding.algorithm.sharding.inline.InlineShardingAlgorithm.init(InlineShardingAlgorithm.java:55)
        at 
org.apache.shardingsphere.infra.util.spi.type.typed.TypedSPIRegistry.findRegisteredService(TypedSPIRegistry.java:66)
        at 
org.apache.shardingsphere.infra.util.spi.type.typed.TypedSPIRegistry.getRegisteredService(TypedSPIRegistry.java:113)
        at 
org.apache.shardingsphere.infra.config.algorithm.ShardingSphereAlgorithmFactory.createAlgorithm(ShardingSphereAlgorithmFactory.java:40)
        at 
org.apache.shardingsphere.sharding.factory.ShardingAlgorithmFactory.newInstance(ShardingAlgorithmFactory.java:45)
        at 
org.apache.shardingsphere.sharding.rule.ShardingRule.lambda$new$0(ShardingRule.java:120)
        at java.util.LinkedHashMap.forEach(LinkedHashMap.java:684)
        at 
org.apache.shardingsphere.sharding.rule.ShardingRule.<init>(ShardingRule.java:120)
        at 
org.apache.shardingsphere.sharding.rule.builder.ShardingRuleBuilder.build(ShardingRuleBuilder.java:41)
        at 
org.apache.shardingsphere.sharding.rule.builder.ShardingRuleBuilder.build(ShardingRuleBuilder.java:35)
        at 
org.apache.shardingsphere.infra.rule.builder.database.DatabaseRulesBuilder.build(DatabaseRulesBuilder.java:58)
        at 
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase.create(ShardingSphereDatabase.java:87)
        at 
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabasesFactory.createGenericDatabases(ShardingSphereDatabasesFactory.java:81)
        at 
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabasesFactory.create(ShardingSphereDatabasesFactory.java:69)
        at 
org.apache.shardingsphere.mode.metadata.MetaDataContextsFactory.create(MetaDataContextsFactory.java:91)
        at 
org.apache.shardingsphere.mode.metadata.MetaDataContextsFactory.create(MetaDataContextsFactory.java:69)
        at 
org.apache.shardingsphere.mode.manager.standalone.StandaloneContextManagerBuilder.build(StandaloneContextManagerBuilder.java:49)
        at 
org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource.createContextManager(ShardingSphereDataSource.java:76)
        at 
org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource.<init>(ShardingSphereDataSource.java:64)
        at 
org.apache.shardingsphere.driver.api.ShardingSphereDataSourceFactory.createDataSource(ShardingSphereDataSourceFactory.java:93)
        at 
org.apache.shardingsphere.spring.boot.ShardingSphereAutoConfiguration.shardingSphereDataSource(ShardingSphereAutoConfiguration.java:91)
        at 
org.apache.shardingsphere.spring.boot.ShardingSphereAutoConfiguration$$EnhancerBySpringCGLIB$$c07aa6bf.CGLIB$shardingSphereDataSource$2(<generated>)
        at 
org.apache.shardingsphere.spring.boot.ShardingSphereAutoConfiguration$$EnhancerBySpringCGLIB$$c07aa6bf$$FastClassBySpringCGLIB$$d6988cf5.invoke(<generated>)
        at 
org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244)
        at 
org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331)
        at 
org.apache.shardingsphere.spring.boot.ShardingSphereAutoConfiguration$$EnhancerBySpringCGLIB$$c07aa6bf.shardingSphereDataSource(<generated>)
        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.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
        ... 106 common frames omitted
   
   
   
   
   


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

Reply via email to