我想在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。