1

i'm new with spring boot so i need your help.

I've got a SOAP ws which receive a parameter in input, depending the value i need to change the default datasource.

in the picture is visible what i have on boostrap.yml

enter image description here

reale is the default

When the ws is invoked i test the parameter e i have to choose between reale and virtuale

How i can do it?

Could someone help me?

Thanks

1 Answer 1

2

Here's an article explaining how to accomplish multiple datasources at runtime: https://grobmeier.solutions/spring-multitenancy-switch-database-at-runtime.html

Basically you need to create each datasource as a different bean and then implement a "Routing" datasource through which all queries go through, the router chooses based on your logic which datasource is executing the query.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.