I want to migrate to Micronaut or Quarkus from Spring Boot, but in Spring boot there is one feature as AbstractRoutingDataSource, which in runtime change datasouce. Is there anything similar or any mechanism in micronaut or quarkus which gives opportunity to work with multiple datasources in runtime??
Spring-boot feature for reference https://medium.com/innomizetech/dynamic-multi-database-application-with-spring-boot-7c61a743e914
Both Micronaut and Quarkus allow you to manage multiple data sources within your application. Here's how you can do it:
Quarkus
In Quarkus, you can define a custom TenantResolver to identify the tenant ID from an incoming request. This ID is then used to pick the appropriate data source. For more information, see the Quarkus documentation on Multitenancy.
Micronaut
Similarly, Micronaut offers a solution via its TenantResolver interface. You have the flexibility to either implement your custom resolver to extract the tenant ID from the request or use one of the many built-in implementations available. For more information, see the Micronaut documentation on Multitenancy.