You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2020/11/16 11:29:31 UTC

[GitHub] [shardingsphere] qsLI edited a comment on issue #8174: No JavaBean properties found in com.sun.proxy.$Proxy203

qsLI edited a comment on issue #8174:
URL: https://github.com/apache/shardingsphere/issues/8174#issuecomment-727919667


   ```java
   @Bean(name = "shardingDateSource")
       public DataSource atourUserDataSource(@Qualifier("ds0") DruidDataSource ds0) throws SQLException {
           Map<String, DataSource> result = new HashMap<>();
   
           result.put("ds0", ds0);
           ShardingRuleConfiguration shardingRuleConfig = new ShardingRuleConfiguration();
           shardingRuleConfig.getTableRuleConfigs()
               .add(getOrderTableRuleConfiguration());
           shardingRuleConfig.getBindingTableGroups()
               .add("meb_discount_coupons");
           shardingRuleConfig.getBroadcastTables()
               .add("meb_discount_type");
           shardingRuleConfig.getBroadcastTables()
               .add("sys_holiday");
   
           final Properties keyGeneratorProperties = new Properties();
           keyGeneratorProperties.put("id.generate.remote", idGenerateRemote);
           shardingRuleConfig.setDefaultKeyGeneratorConfig(
               new KeyGeneratorConfiguration("ATOUR-FLAKE", "coupon_id", keyGeneratorProperties));
           shardingRuleConfig.setDefaultTableShardingStrategyConfig(new InlineShardingStrategyConfiguration("meb_id",
               "meb_discount_coupons_${meb_id % " + shardingTableNodes + "}"));
           Properties properties = new Properties();
   
           /*
            * 开启sql日志
            */
           properties.setProperty(ShardingPropertiesConstant.SQL_SHOW.getKey(), String.valueOf(showSql));
           properties.setProperty(ShardingPropertiesConstant.MAX_CONNECTIONS_SIZE_PER_QUERY.getKey(), String.valueOf(4));
   
           return ShardingDataSourceFactory.createDataSource(result, shardingRuleConfig, properties);
   
       }
   ```


----------------------------------------------------------------
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:
users@infra.apache.org