lcjing commented on issue #31618:
URL: 
https://github.com/apache/shardingsphere/issues/31618#issuecomment-2159971413

   
   
   * I try it again and the result is still the same. I don't think you need my 
example to reproduce it, you can see 
`org.apache.shardingsphere.infra.datasource.pool.creator.DataSourcePoolCreator`
   
   ```java
   /**
    * Create data source.
    *
    * @param props data source pool properties
    * @return created data source
    */
   public static DataSource create(final DataSourcePoolProperties props) {
       DataSource result = create(props.getPoolClassName());
       Optional<DataSourcePoolMetaData> poolMetaData = 
TypedSPILoader.findService(DataSourcePoolMetaData.class, 
props.getPoolClassName());
       DataSourcePoolReflection dataSourcePoolReflection = new 
DataSourcePoolReflection(result);
       if (poolMetaData.isPresent()) {
           setDefaultFields(dataSourcePoolReflection, poolMetaData.get());
           setConfiguredFields(props, dataSourcePoolReflection, 
poolMetaData.get());
           appendJdbcUrlProperties(props.getCustomProperties(), result, 
poolMetaData.get(), dataSourcePoolReflection);
           
dataSourcePoolReflection.addDefaultDataSourcePoolProperties(poolMetaData.get());
       } else {
           setConfiguredFields(props, dataSourcePoolReflection);
       }
       return result;
   }
   ```
   
   * Eventually, it will be called 
`org.apache.shardingsphere.infra.datasource.pool.creator.DataSourcePoolReflection.setField(final
 String fieldName, final Object fieldValue)`
   
   ```java
   static {
       SKIPPED_PROPERTY_KEYS = new HashSet<>(Arrays.asList("loginTimeout", 
"driverClassName"));
   }
   
   private boolean isSkippedProperty(final String key) {
       return SKIPPED_PROPERTY_KEYS.contains(key);
   }
   
   public void setField(final String fieldName, final Object fieldValue) {
       if (null != fieldValue && !isSkippedProperty(fieldName)) {
           findSetterMethod(fieldName).ifPresent(optional -> setField(optional, 
fieldValue));
       }
   }
   ```
   
   * From the above code, it can be seen that no matter how the 
`driverClassName` is configured, the property value will not be set through 
reflection, and the `driverClassName` will always be null


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