Properties in ActivePivot
The properties defined and used in ActivePivot for configuration purposes are centralized in a single accessor/setter. Those properties are now also defined and documented in a single ActiveViamProperty.java file.
The new mechanism for property handling in ActivePivot allows the usage of both s JVM Arguments,System/Environment properties and External property files.
ActivePivot Properties
Properties in ActivePivot now are defined and documented in the ActiveViamProperty class. They correspond to the properties used to configure ActivePivot as well as other ActiveViam products.
The PropertyRegistry
The PropertyRegistry class contains the information about resolved Properties and their current values.
By default, ActivePivot provides the property handling mechanism that can use the following sources for ActivePivot properties :
- System properties (JVM -Dxxx arguments)
- Environment properties
IF you have imported the provided
ActiveViamPropertyFromSpringConfigconfiguration class - External property files mentioned in
@PropertySource()annotations
Properties defined in the Spring environment through property files are resolved during the Bean initializing phase only if the ActiveViamPropertyFromSpringConfig configuration class was requested in the Spring configuration.
This can be done through Spring annotations :
@Importannotation declares an import of a Configuration class from which to load beans and/or nested Configurations are to be resolved.@ContextConfigurationannotation defines the Configurations classes to load in a Test class. It requires the following annotation to properly work in tests :@RunWith(SpringJUnit4ClassRunner.class)
Once the Registry has been instantiated, it is not possible to dynamically reload properties of the registry from the Sources. Any attempt to programmatically change ActivePivot Properties should be done through the
ActiveViamPropertyRegistryAPI.
The ActiveViamPropertyRegistry provides several methods to handle properties :
- Type-specific accessors with default fallback value:
getString(),getInteger(),getLong(),getBoolean(),getDouble - Type-specific accessors with required value:
getRequiredString(),getRequiredInteger(),getRequiredLong(),getRequiredBoolean(),getRequiredDouble. When a requested property is not defined in thePropertyRegistrywhile calling these methods, an exception will be thrown. - Generic setter
set() - Entry deletion method
clear()
Resolving Properties
The properties are resolved in the following order, from the highest priority source to the lowest one :
- Properties defined in the Spring Environment (if Spring configuration classes are imported)
- System properties (-DXXX arguments)
- Environment properties