on 2015 Jul 23 3:34 PM
What is the best practice to get the configuration, using the static de.hybris.platform.util.Config class or using the de.hybris.platform.servicelayer.config.ConfigurationService?
de.hybris.platform.util.Config
Method getParameter
Method getParameterByPattern
de.hybris.platform.servicelayer.config.ConfigurationService
Method getConfiguration
org.apache.commons.configuration.Configuration
public abstract Configuration subset(String paramString);
public abstract boolean isEmpty();
public abstract boolean containsKey(String paramString);
public abstract void addProperty(String paramString, Object paramObject);
public abstract void setProperty(String paramString, Object paramObject);
public abstract void clearProperty(String paramString);
public abstract void clear();
public abstract Object getProperty(String paramString);
public abstract Iterator getKeys(String paramString);
public abstract Iterator getKeys();
public abstract Properties getProperties(String paramString);
public abstract boolean getBoolean(String paramString);
public abstract boolean getBoolean(String paramString, boolean paramBoolean);
public abstract Boolean getBoolean(String paramString, Boolean paramBoolean);
public abstract byte getByte(String paramString);
public abstract byte getByte(String paramString, byte paramByte);
public abstract Byte getByte(String paramString, Byte paramByte);
public abstract double getDouble(String paramString);
public abstract double getDouble(String paramString, double paramDouble);
public abstract Double getDouble(String paramString, Double paramDouble);
public abstract float getFloat(String paramString);
public abstract float getFloat(String paramString, float paramFloat);
public abstract Float getFloat(String paramString, Float paramFloat);
public abstract int getInt(String paramString);
public abstract int getInt(String paramString, int paramInt);
public abstract Integer getInteger(String paramString, Integer paramInteger);
public abstract long getLong(String paramString);
public abstract long getLong(String paramString, long paramLong);
public abstract Long getLong(String paramString, Long paramLong);
public abstract short getShort(String paramString);
public abstract short getShort(String paramString, short paramShort);
public abstract Short getShort(String paramString, Short paramShort);
public abstract BigDecimal getBigDecimal(String paramString);
public abstract BigDecimal getBigDecimal(String paramString, BigDecimal paramBigDecimal);
public abstract BigInteger getBigInteger(String paramString);
public abstract BigInteger getBigInteger(String paramString, BigInteger paramBigInteger);
public abstract String getString(String paramString);
public abstract String getString(String paramString1, String paramString2);
public abstract String[] getStringArray(String paramString);
public abstract List getList(String paramString);
public abstract List getList(String paramString, List paramList);
Ofcourse the org.apache.commons.configuration.Configuration has a lot of utility methods, but if you just need a String I think the Config.getParameter can be enough.
What do you use in your project?
Request clarification before answering.
Config
class also uses Tenant
interface internally (so it's possible to have that interface flexibility whenever needed). It's a publicly available class without any sign of deprecation. It's also more elegant to use.
So it's rather a matter of a taste.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
19 | |
16 | |
3 | |
2 | |
2 | |
2 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.