jpenalver10 opened a new issue, #37572:
URL: https://github.com/apache/shardingsphere/issues/37572
Hi everyone, I have a question regarding the definition of an own
CLASS_BASED sharing algorithm in a Spring Boot application.
I need to define a programatic sharding rule based on the customer ID and I
want to store these configuration in a database table that will be filled based
on business rules. As my application is a SpringBoot application I want to be
able to inject the JPA repository into my sharding algorithm to retrieve the
config from database.
I realize that using the standard configuration, ShardingSphere builds the
class instance using the default constructor, so can't inject anything and the
algorithm don't belongs to Spring context.
```
shardingAlgorithms:
customer-to-shard:
type: CLASS_BASED
props:
strategy: STANDARD
algorithmClassName:
com.jpenalver10.dbsharding.TenantShardingAlgorithm
```
Is there any recommended/official way to do this?
Thank you so much.
--
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]