我想在Spring應用程序中使用apache commons配置替換PropertiesFactoryBean。Apache Commons配置與PropertyPlaceHolderConfigurer的兼容性
在我看來,commons配置框架與PropertyPlaceHolderConfigurer不兼容,也不與@Value註釋兼容。
如果你建議我一個解決方案,請注意,我只用xml配置了spring。
感謝, 馬里奧
我想在Spring應用程序中使用apache commons配置替換PropertiesFactoryBean。Apache Commons配置與PropertyPlaceHolderConfigurer的兼容性
在我看來,commons配置框架與PropertyPlaceHolderConfigurer不兼容,也不與@Value註釋兼容。
如果你建議我一個解決方案,請注意,我只用xml配置了spring。
感謝, 馬里奧
你是正確的。 commons-config是古老的,不會從花園蝸牛那裏知道。 @Value意味着大量昂貴的機制涉及註釋的反射和檢查 - 如果您仍需要@Value,則可能需要重新考慮擺脫Spring。
供將來參考:以前的答案不再正確。 Commons Configuration能夠與PropertyPlaceholderConfigurer進行交互,詳情請參閱 http://commons.apache.org/proper/commons-configuration/userguide/howto_utilities.html#Use_Configuration_in_Spring。