Hello All,
I am trying to create wrapper for integrating multiple databases in spring boot.
In order to scan Repositories, i am creating Configuration class file annotated with @EnableJpaRepositories at runtime.
Steps :
1. Read multiple database configurations for some config file.
2. Create @Configuration class file for each database at runtime
3. Register this configuration bean in spring boot at runtime.
Below is my code :
My dynamically created @Configuration class file looks something this :
I am modifying the attributes of @EnableJpaRepositories at runtime and then registering the bean. Below is the code for that
Problem is : when i am running the code bean is getting registered, but code erros out when i @Autowire any repository class. It says "required a bean of type XYZ Repository not found".
Ideally when the bean is registered @EnableJpaRepositories with updated basepackageName it should have scanned them right ?
Please help me here, what am i doing wrong here
Thanks
Amit