Config.getString() 和 configurationService.getConfiguration().getString() 有什么区别

问题描述

无论哪种方式,我们都可以从 .property 文件获取我们想要的字符串属性。那么hybris平台中的Config.getString()configurationService.getConfiguration().getString()有什么区别?

作为另一个问题;

如果我们 getString() 一个属性project.propertieslocal.properies 中都存在且具有不同的值,我们会得到哪一个

解决方法

我没有比较两者之间的差异,但作为最佳实践,ConfigurationService 是首选。

来自Example of a Code Review Checklist

Configuration - Use the ConfigurationService interface rather than the de.hybris.platform.util.Config object.