Is there any way to load a entire folder with @Configuration files, the same way XML have: <import resource="folder/*.xml" />
, but with annotations?.
You could probably use component scanning.
@Configuration
@ComponentScan(basePackages = "org.example.configs")
public class Config {
}
All @Configuration classes from the org.example.configs
package will be included in the context.
Typesafe alternative:
// org.example.configs.SubConfig
@ComponentScan(basePackageClasses = SubConfig.class)