Jpa configuration loads the essential beans, scans entities and enables repositories. Based on some condition at run time, I would like to add a few more packages to be scanned for entities and repositories and wire them in bean factory. The extra packages to be scanned is available only at run time.
@Configuration
@EnableJpaRepositories
@EntityScan
@PropertySource(value = "classpath:jpa.properties")
@EnableTransactionManagement(proxyTargetClass = true)
@EnableJpaAuditing
public class JpaConfiguration {
...
...
public void condition(){
if(someCondition){
//scan more entities
//enable more repositories
}
}
}
Is it possible to do something like this?