qh3001 commented on issue #33937:
URL:
https://github.com/apache/shardingsphere/issues/33937#issuecomment-2523245463
I has config the shardingsphere datasource as the official website
suggest,and now I need to get the datasource in Spring beans because I have
multiple datasources, so how can I get the shardingsphere configured datasoure?
The shardingsphere config like below:
```
spring:
shardingsphere:
props:
sql-show: true
datasource:
ds0:
type: com.zaxxer.hikari.HikariDataSource
driver-class-name: com.mysql.jdbc.Driver
url:
jdbc:mysql://localhost:3306/test?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
username: *
password: *
names: ds0
rules:
sharding:
tables:
doc_order:
actualDataNodes:
ds0.doc_order01,ds0.doc_order02,ds0.doc_order03,ds0.doc_order04,ds0.doc_order05,ds0.doc_order06,ds0.doc_order07,ds0.doc_order08,ds0.doc_order09,ds0.doc_order10,ds0.doc_order11,ds0.doc_order12
tableStrategy:
standard:
shardingColumn: create_time
shardingAlgorithmName: order_interval
keyGenerateStrategy:
column: id
keyGeneratorName: snowflake
auditStrategy:
auditorNames:
- sharding_key_required_auditor
allowHintDisable: true
doc_order_item:
actualDataNodes:
ds0.doc_order_item01,ds0.doc_order_item02,ds0.doc_order_item03,ds0.doc_order_item04,ds0.doc_order_item05,ds0.doc_order_item06,ds0.doc_order_item07,ds0.doc_order_item08,ds0.doc_order_item09,ds0.doc_order_item10,ds0.doc_order_item11,ds0.doc_order_item12
tableStrategy:
standard:
shardingColumn: create_time
shardingAlgorithmName: order_item_interval
keyGenerateStrategy:
column: id
keyGeneratorName: snowflake
bindingTables:
- doc_order,doc_order_item
sharding-algorithms:
order_interval:
type: INTERVAL
props:
datetime-pattern: yyyy-MM-dd HH:mm:ss
datetime-lower: 2023-01-01 00:00:00
datetime-upper: 2050-01-01 00:00:00
sharding-suffix-pattern: MM
datetime-interval-unit: MONTHS
order_item_interval:
type: INTERVAL
props:
datetime-pattern: yyyy-MM-dd HH:mm:ss
datetime-lower: 2023-01-01 00:00:00
datetime-upper: 2050-01-01 00:00:00
sharding-suffix-pattern: MM
datetime-interval-unit: MONTHS
keyGenerators:
snowflake:
type: SNOWFLAKE
props:
worker-id: 123
mode:
type: Memory
```
--
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]