Can I use a property loaded from property-placeholder to make a context import dynamic?
This is a similar question to this one.
Imports are resolved before bean (property-placeholder) creation, so you can not use the property file to define properties which you want to use in an import statement. In this case you have to set the property as system property
(-Djdbc.ctxType=JTA
) (have a look at the link - paragraph Note).
But using the property file properties in bean definitions works fine - that's what they are for :-)
Update: Since Spring 3.1 the Unified Property Management allows to use properties even in imports (thanks @Jay Blanton for mentioning this in the comments).
Yes, you can. You can use expressions in imports and injections.