I am trying to migrate our application from Spring XML based configuration to annotation based configuration. In one of our XML files, say application-config.xml
, we have the following line:
<import resource="${jobName}/beans.xml" />
Here ${jobName}
is a System property which is set at JVM startup. There are additional system properties that are used to load additional XML resources. Now in my annotation based configuration, I want to have similar @Configuration
classes as the XML files themselves. Hence I have a class ApplicationConfig
that will import the jobName
specific Configuration
class.
How do I achieve this?
@Configuration
@Import({somehow-need-to-use-system-property-to-import-appropriate-class})
class ApplicationConfiguration {
//bean definitions
}