I would like to import different resource files based on some condition. Is this possible?
These don't work:
<import resource="#{ systemProperties['foo'] }.xml" />
<import resource="#{ T(my.testpkg).getValue() }.xml" />
SpEL is supported, but Spring resolves the import statement very early on.
When spring is resolving import statements, property placeholders have not yet been resolved.
For example:
Define the following properties:
import.fileName=${blah}
blah=properties.props
We can then use the 'import.fileName' property as a parameter to the import
<import resource="${import.fileName}" />
This resolves to:
<import resource="${blah}" />
And presumably the resource '${blah}' does not exist.
That being said, you can use properties to resolve import file names.