public class PropertyLoader extends Object
This will also pick up property files with names suffixed with -<project stage>
, e.g.
myconfig-Production.properties.
User configurations should have deltaspike_ordinal
as the first property, with a value greater than
100.
Modifier and Type | Field and Description |
---|---|
static int |
CONFIGURATION_ORDINAL_DEFAULT_VALUE |
Modifier and Type | Method and Description |
---|---|
static Properties |
getProperties(String propertyFileName)
Looks for all properties files with the given name in the classpath, loads them in ascending order determined by
their ordinal and merges them.
|
public static final int CONFIGURATION_ORDINAL_DEFAULT_VALUE
public static Properties getProperties(String propertyFileName)
The idea is to be able to override properties by just providing a new properties file with the same name but a higher 'deltaspike_ordinal' than the old one.
If a property file defines no 'deltaspike_ordinal' property than a default value of
CONFIGURATION_ORDINAL_DEFAULT_VALUE
is assumed. Any sensitive default which is provided by the system
parsing for the configuration should have a 'deltaspike_ordinal' value lower than 10. In most cases a value of
1.
If two property files have the same 'deltaspike_ordinal', their order is undefined. The Properties file which gets found first will be processed first and thus gets overwritten by the one found later.
propertyFileName
- the name of the properties file, without the extension '.properties'Copyright © 2020 The Apache Software Foundation. All rights reserved.