2012-12-05 45 views

回答

2

ref屬性值必須是一個字符串,而不是引用本身,所以,我會嘗試返回foobar作爲一個字符串,如:

<constructor-arg ref="#{(config.isFooEnabled()) ? 'foo' : 'bar'}"/> 

Spring bean引擎將得到表達式返回的字符串,並解析引用。

相關問題