Reputation: 395
Is there any way to load a entire folder with @Configuration files, the same way XML have: <import resource="folder/*.xml" />
, but with annotations?.
Upvotes: 0
Views: 524
Reputation: 4106
The pendant of <import resource="folder/*.xml" />
but using configuration is @ImportResource
For example:
@Configuration
@ImportResource("folder/*.xml")
public class MyConfiguration {}
Upvotes: 2
Reputation: 1015
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)
Upvotes: 1