I have project setup using Spring boot that loads individual components on startup. Each individual packages contain its own datasource, processes, etc. I can simply use this and it works fine
@SpringBootApplication(scanBasePackages = {
"com.package1",
"com.package2",
"com.package3"
})
public class Application extends SpringBootServletInitializer{
public static void main(String[] args){
SpringApplication.run(Application.class,args)
}
}
But currently, the number of indiviual projects are getting bigger. Is it possible to put the list of the components / packages to scan in an external properties file or spring vault? I'm not sure how to retrieve it, and is it possible to retrieve the properties before the boot?
Edit:
Currently I tried this:
@Import(AppConfig.class)
public class Application extends SpringBootServletInitializer{
public static void main(String[] args){
SpringApplication.run(Application.class,args)
}
}
@Configuration
@ComponentScan(basePackages = {$app.packages})
@EnableAutoConfiguration
public class AppConfig {
}
//in my properties file
app.packages = ["com.package1","com.package2","com.package3"]
but its not working