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 2021/01/23 08:03:52 UTC

[GitHub] [shardingsphere] 1156721874 opened a new issue #9138: how can i use use sharding database and sharding tables and encrypt future?, and how config it ?

1156721874 opened a new issue #9138:
URL: https://github.com/apache/shardingsphere/issues/9138


   sharding-jdbc-spring-boot-starter
   version:4.1.1
   
   `public class SpringBootConfiguration implements EnvironmentAware {
   .... ignore code ......
       @Bean
       @Conditional(ShardingRuleCondition.class)
       public DataSource shardingDataSource() throws SQLException {
           return ShardingDataSourceFactory.createDataSource(dataSourceMap, new 
                                ShardingRuleConfigurationYamlSwapper().swap(shardingRule), props.getProps());
       }
   
       @Bean
       @Conditional(MasterSlaveRuleCondition.class)
       public DataSource masterSlaveDataSource() throws SQLException {
           return MasterSlaveDataSourceFactory.createDataSource(dataSourceMap, new 
                     MasterSlaveRuleConfigurationYamlSwapper().swap(masterSlaveRule), props.getProps());
       }
   
       @Bean
       @Conditional(EncryptRuleCondition.class)
       public DataSource encryptDataSource() throws SQLException {
           return EncryptDataSourceFactory.createDataSource(dataSourceMap.values().iterator().next(), new 
                     EncryptRuleConfigurationYamlSwapper().swap(encryptRule), props.getProps());
       }
   
       @Bean
       @Conditional(ShadowRuleCondition.class)
       public DataSource shadowDataSource() throws SQLException {
           return ShadowDataSourceFactory.createDataSource(dataSourceMap, new 
                  ShadowRuleConfigurationYamlSwapper().swap(shadowRule), props.getProps());
       }
   .... ignore code ......
   }`
   
   question:
   this SpringBootConfiguration  class have 4 DataSources(exists 4 @Bean annotationed method)  will be register into spring container, now i want to use sharding database and sharding tables and encrypt future ,but i view  @Conditional(ShardingRuleCondition.class) ,its implement is that:
   `public final class ShardingRuleCondition extends SpringBootCondition {
       
       @Override
       public ConditionOutcome getMatchOutcome(final ConditionContext conditionContext, final AnnotatedTypeMetadata annotatedTypeMetadata) {
           boolean isMasterSlaveRule = new MasterSlaveRuleCondition().getMatchOutcome(conditionContext, annotatedTypeMetadata).isMatch();
           boolean isEncryptRule = new EncryptRuleCondition().getMatchOutcome(conditionContext, annotatedTypeMetadata).isMatch();
           boolean isShadow = new ShadowRuleCondition().getMatchOutcome(conditionContext, annotatedTypeMetadata).isMatch();
           return isMasterSlaveRule || isEncryptRule || isShadow ? ConditionOutcome.noMatch("Have found master-slave or encrypt rule in environment") : ConditionOutcome.match();
       }
   }` 
   
   thats means if my configuration is exist isEncryptRule(spring.shardingsphere.encrypt.encryptors or spring.shardingsphere.encrypt.tables prefix) condation, will return ConditionOutcome.noMatch("Have found master-slave or encrypt rule in environment") , and  **shardingDataSource will not be register into spring container**  ,how can i use use sharding database and sharding tables and encrypt future?, and how config it ?
   


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



[GitHub] [shardingsphere] 1156721874 commented on issue #9138: how can i use use sharding database and sharding tables and encrypt future?, and how config it ?

Posted by GitBox <gi...@apache.org>.
1156721874 commented on issue #9138:
URL: https://github.com/apache/shardingsphere/issues/9138#issuecomment-765886339


   fix code style


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



[GitHub] [shardingsphere] terrymanu commented on issue #9138: how can i use use sharding database and sharding tables and encrypt future?, and how config it ?

Posted by GitBox <gi...@apache.org>.
terrymanu commented on issue #9138:
URL: https://github.com/apache/shardingsphere/issues/9138#issuecomment-774609266


   The document is going on about mix configuration.
   Please follow #9286


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



[GitHub] [shardingsphere] terrymanu closed issue #9138: how can i use use sharding database and sharding tables and encrypt future?, and how config it ?

Posted by GitBox <gi...@apache.org>.
terrymanu closed issue #9138:
URL: https://github.com/apache/shardingsphere/issues/9138


   


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



[GitHub] [shardingsphere] 1156721874 removed a comment on issue #9138: how can i use use sharding database and sharding tables and encrypt future?, and how config it ?

Posted by GitBox <gi...@apache.org>.
1156721874 removed a comment on issue #9138:
URL: https://github.com/apache/shardingsphere/issues/9138#issuecomment-765886339


   fix code style


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