Dynamic initialize spring boot jpa repository

Viewed 184

I have a spring boot app with one web endpoint taking database name as a query param .

GET /myapp/initdb?dbname=xyz

I have one JPA repository

@Repository
public interface UserDataRepository

now i want to initialize the UserDataRepo based on the dbname inputed from the user.

So effectively i want to dynamically create JPA Repo during runtime based on different inputs from the user

How this can be achieved?

0 Answers
Related