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

   ## Bug Report
   
   Caused by: java.lang.IllegalArgumentException: Property 'sqlSessionFactory' 
or 'sqlSessionTemplate' are required
        at org.springframework.util.Assert.notNull(Assert.java:204) 
~[spring-core-6.0.11.jar:6.0.11]
        at 
org.mybatis.spring.support.SqlSessionDaoSupport.checkDaoConfig(SqlSessionDaoSupport.java:122)
 ~[mybatis-spring-2.0.7.jar:2.0.7]
        at 
org.mybatis.spring.mapper.MapperFactoryBean.checkDaoConfig(MapperFactoryBean.java:73)
 ~[mybatis-spring-2.0.7.jar:2.0.7]
        at 
org.springframework.dao.support.DaoSupport.afterPropertiesSet(DaoSupport.java:44)
 ~[spring-tx-6.0.11.jar:6.0.11]
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1817)
 ~[spring-beans-6.0.11.jar:6.0.11]
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1766)
 ~[spring-beans-6.0.11.jar:6.0.11]
        ... 58 common frames omitted
   
   ### Which version of ShardingSphere did you use?
   ```
   `
   <dependency>
       <groupId>org.apache.shardingsphere</groupId>
       <artifactId>sharding-core-api</artifactId>
       <version>5.2.0</version>
   </dependency>
   <dependency>
         <groupId>org.apache.shardingsphere</groupId>
         <artifactId>sharding-core-api</artifactId>
         <version>4.1.1</version>
     </dependency>
   
   `
   java17 
   springboot3  
   mybatisplus3.5.2
   druid-spring-boot-starter-1.2.8
   ```
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   ShardingSphere-JDBC
   ### Expected behavior
   Normal add data
   ### Actual behavior
   springboot lunch error
   ### Reason analyze (If you can)
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule 
configuration, when exception occur etc.
   
   
   
   ### Example codes for reproduce this issue (such as a github link).
   pom.xml
   ```<?xml version="1.0" encoding="UTF-8"?>
   <project xmlns="http://maven.apache.org/POM/4.0.0";
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
            xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
       <modelVersion>4.0.0</modelVersion>
   
       <groupId>com.ingsha</groupId>
       <artifactId>intellij_study_platform</artifactId>
       <version>1.0.0</version>
       <packaging>pom</packaging>
       <modules>
           <module>user-interface</module>
           <module>application</module>
           <module>domain</module>
           <module>event</module>
           <module>infrastructure</module>
           <module>application-layer</module>
           <module>common</module>
       </modules>
   
       <properties>
           <maven.compiler.source>17</maven.compiler.source>
           <maven.compiler.target>17</maven.compiler.target>
           <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
           <!--spring && springboot -->
           <spring-boot.version>3.1.2</spring-boot.version>
           <!-- db -->
           <druid.version>1.2.8</druid.version>
           <mysql.version>8.0.17</mysql.version>
           <shardingsphere.version>5.2.0</shardingsphere.version>
           <sharding-core-api.version>4.1.1</sharding-core-api.version>
           <mybatis-plus.version>3.5.2</mybatis-plus.version>
       </properties>
   
       <dependencyManagement>
           <dependencies>
               <dependency>
                   <groupId>org.apache.shardingsphere</groupId>
                   <artifactId>sharding-core-api</artifactId>
                   <version>${sharding-core-api.version}</version>
               </dependency>
               <dependency>
                   <groupId>org.springframework.boot</groupId>
                   <artifactId>spring-boot-dependencies</artifactId>
                   <version>${spring-boot.version}</version>
                   <type>pom</type>
                   <scope>import</scope>
               </dependency>
               <dependency>
                   <groupId>com.baomidou</groupId>
                   <artifactId>mybatis-plus-boot-starter</artifactId>
                   <version>${mybatis-plus.version}</version>
               </dependency>
               <dependency>
                   <groupId>com.alibaba</groupId>
                   <artifactId>druid-spring-boot-starter</artifactId>
                   <version>${druid.version}</version>
               </dependency>
               <dependency>
                   <groupId>org.apache.shardingsphere</groupId>
                   
<artifactId>shardingsphere-jdbc-core-spring-boot-starter</artifactId>
                   <version>${shardingsphere.version}</version>
               </dependency>
               <dependency>
                   <groupId>mysql</groupId>
                   <artifactId>mysql-connector-java</artifactId>
                   <version>${mysql.version}</version>
               </dependency>
               <dependency>
                   <groupId>com.alibaba</groupId>
                   <artifactId>druid</artifactId>
                   <version>${druid.version}</version>
               </dependency>
               
      
           </dependencies>
       </dependencyManagement> 
   </project>
   ```
   
   application.yml
   ```
   ...
   mybatis-plus:
     configuration:
       log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
   
   spring:
     shardingsphere:
       mode:
         type: Memory
       datasource:
         names: ds0
         ds0:
           type: com.alibaba.druid.pool.DruidDataSource
           driverClassName: com.mysql.cj.jdbc.Driver
           url: 
jdbc:mysql://xxx:3306/oauth_role?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai&useTimezone=true&tinyInt1isBit=false
           username: root
           password: "root"
           min-idle: 2
           initial-size: 1
           max-total: 5
           max-wait-millis: 200
           connectProperties: { connectionInitSqls: SET NAMES utf8mb4 }
       #        connectionInitSqls: SET NAMES utf8mb4  #让 druid 支持特殊字符 
加上shardingsphere会报错
       rules:
         defaultDatabaseStrategy:
           inline:
             sharding-column: id
             algorithm-expression: ds0
         defaultKeyGenerateStrategy:
           type: MyShardingKeyGenerator
           column: id
   #      tables:
   #        sys_user:
   #          actual-data-nodes: ds0.sys_user_$->{0..1}
   #          key-generator:
   #            column: id
   #            type: MyShardingKeyGenerator
   #          table-strategy:
   #            inline:
   #              sharding-column: id
   #              algorithm-expression: sys_user_$->{id % 2}
   #        sys_user_role:
   #          actual-data-nodes: ds0.sys_user_role_$->{0..1}
   #          key-generator:
   #            column: user_id
   #            type: MyShardingKeyGenerator
   #          table-strategy:
   #            inline:
   #              sharding-column: user_id
   #              algorithm-expression: sys_user_role_$->{user_id % 2}
   #        user_oss_record:
   #          actual-data-nodes: ds0.user_oss_record_$->{0..1}
   #          key-generator:
   #            column: user_id
   #            type: MyShardingKeyGenerator
   #          table-strategy:
   #            inline:
   #              sharding-column: user_id
   #              algorithm-expression: user_oss_record_$->{user_id % 2}
   #        user_info:
   #          actual-data-nodes: ds0.user_info_$->{0..1}
   #          key-generator:
   #            column: user_id
   #            type: MyShardingKeyGenerator
   #          table-strategy:
   #            inline:
   #              sharding-column: user_id
   #              algorithm-expression: user_info_$->{user_id % 2}
   
   #      default-table-strategy:
   #        inline:
   #          sharding-column: id
   #          algorithm-expression: ds0
   
   ```
   


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