AI1186780944 opened a new issue #9228:
URL: https://github.com/apache/shardingsphere/issues/9228


   ## Question
   How can shardingsphere use read-write separation and data desensitization at 
the same time?
   
   the version:sharding-jdbc:4.1.1
   
   In actual use, I found that if the configuration of read-write separation 
and data desensitization is added at the same time, the bean of 
"platformtransactionmanager" class cannot be found. The reason is that 
"encrypydatasource" and "masterslavedatasource" are generated, which will cause 
an exception that cannot normally inject transactionmanager into bean, 
resulting in service startup failure.
   
   At the same time, based on this exception, I have tried to specify the data 
source manually. But it also involves the injection of entity manager factory. 
Usually, the entity manager factory is closely related to the session factory. 
The session factory of each data source is a different object.
   
   After carefully reading the documents you provided, I found that you only 
gave the examples of data fragmentation and read-write separation, and data 
fragmentation and data desensitization, but not the examples of read-write 
separation and data desensitization. Is it not supported to use these two 
functions at the same time?
   
   My configuration is as follows:
   
   spring.shardingsphere.sharding.default-data-source-name=master
   
   
spring.shardingsphere.datasource.master.type=com.alibaba.druid.pool.DruidDataSource
   
spring.shardingsphere.datasource.master.driver-class-name=com.mysql.cj.jdbc.Driver
   
spring.shardingsphere.datasource.master.url=jdbc:mysql://xxx.xxx.xxx.xxx:3306/order?useUnicode=true&characterEncoding=utf-8&#useSSL=false&serverTimezone=GMT%2B8
   spring.shardingsphere.datasource.master.username=test_rw
   spring.shardingsphere.datasource.master.password=Kyig&pnlGnaHaJ
   
   
spring.shardingsphere.datasource.slave.type=com.alibaba.druid.pool.DruidDataSource
   
spring.shardingsphere.datasource.slave.driver-class-name=com.mysql.cj.jdbc.Driver
   
spring.shardingsphere.datasource.slave.url=jdbc:mysql://xxx.xxx.xxx.xxx:3306/order?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8
   spring.shardingsphere.datasource.slave.username=test_rw
   spring.shardingsphere.datasource.slave.password=Kyig&pnlGnaHaJ
   
   spring.shardingsphere.masterslave.name=testMaster1Slave1
   spring.shardingsphere.masterslave.master-data-source-name=master
   spring.shardingsphere.masterslave.slave-data-source-names=slave
   spring.shardingsphere.props.sql.show=true
   
   
spring.shardingsphere.sharding.default-database-strategy.hint.algorithm-class-name=xxx
   
   spring.shardingsphere.encrypt.encryptors.encryptor_aes.type=aes
   
spring.shardingsphere.encrypt.encryptors.encryptor_aes.props.aes.key.value=xxxxxxxx
   spring.shardingsphere.props.query.with.cipher.column=fasle
   
spring.shardingsphere.encrypt.tables.order_item_guardian.columns.id_no.plainColumn=id_no
   
spring.shardingsphere.encrypt.tables.order_item_guardian.columns.id_no.cipherColumn=id_no_encrypt
   
spring.shardingsphere.encrypt.tables.order_item_guardian.columns.id_no.encryptor=encryptor_aes


----------------------------------------------------------------
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:
[email protected]


Reply via email to