Property Placeholder for Imports/Bean Refs

后端 未结 2 1498
耶瑟儿~
耶瑟儿~ 2020-12-29 10:52

Can I use a property loaded from property-placeholder to make a context import dynamic?



        
相关标签:
2条回答
  • 2020-12-29 11:14

    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).

    0 讨论(0)
  • 2020-12-29 11:30

    Yes, you can. You can use expressions in imports and injections.

    0 讨论(0)
提交回复
热议问题